Xpages Layout Control - Node Image path - xpages

I use Application Layout control (OneUI 3.0.2) with a few Application Links.
The image path is calculated because the images are saved in a separate image application.
The problem is that the Layout Control always add the path of the current application in front of the calculated link.
The only way i found was to calculate the absolute path (with http://..) to avoid this. But for me this is not a good solution, specially when you want to use a reverseproxy in front.

The image path is relative to current database by default.
Add "/.ibmxspres/domino/" in front of your image path to make it relative to Domino server's data directory instead.
Example:
Application path: /apps/hr/hr.nsf
Image database path: /core/images.nsf
<xe:basicLeafNode
...
image="/.ibmxspres/domino/core/images.nsf/yourImage.gif">
In case the image database is in same directory like your application database you can set image's path relative to current database path.
Navigate from application database path back to common directory with /.. and then to your database.
<xe:basicLeafNode
...
image="/../images.nsf/yourImage.gif">

Related

How to check if image is loaded in Express and replace with default local image?

I have collection with image, where the src is external URL.
I want when the image is not found(not working url), to be replace it with local default image?
Is there a way to check if the image is loaded and replace it in middleware? Some equivalent onError event in the browser?
I found front-end solution, in which is added event listener for 'onerror' event to every image and replace its src attribute. I need back-end solution!

Jhipster - [src]="getImageUrl()" for user's avatar image not working

I have updated column: image_url in [jhi_user] table with different values, and nothing seems to work, example: image_url= ../../../content/media/angular-js.png
Question:
Where in jhipster's file structure should i create a folder to hold user's profiles pictures, and what should the image_url value be so that it works with
<img [src]="getImageUrl()">
It's worth mentioning that this works:
<img src="../../../content/media/angular-js.png">
i created a folder "media" with image: angular-js.png
I am using mysql database and generator-jhipster: "4.6.2"
Thank you for your help in advance
There are 2 kind of images in web apps: the static assets are used for layout (icons, background, logos, ...) they are bundled within your app and the other ones that can be changed without rebuilding your app and which are data.
Static assets can be long term cached by the browser, this is why JHipster uses webpack to version their URLs with a hash code, to modify files that reference them (html, css) and bundle them.
In your design, your image URL is stored in a column of the User entity that points to an avatar image which is a static asset. So webpack is not able to rewrite it.
So either you exclude these images from webpack build process or you store your images as Blobs in your database to enable your users to upload their own images.
Second option would consist in creating a new entity Avatar that holds the Blob and have a one-to-one relationship with User entity. The reason for another entity si that JHipster does not let you modify the User entity.

Cant access images one directory back

I am using linux server and I am using absolute path for files which is stored in a "constant"
File path is
/home1/mousi1/public_html/xyz/data/1465221530.png
Image is loading when I access file which is on home directory like
/home1/mousi1/public_html/xyz/file.php
but when I try
/home1/mousi1/public_html/xyz/subdirectory/file.php
Path is still
/home1/mousi1/public_html/xyz/data/1465221530.png
but image is not showing I am wondering why is it?
What is wrong?

Image in Local Folder from WebView

I am working on a project where I need to access an image stored in the applications local folder from within a webview control. When I try to use the ms-appdata:/// scheme it does not work.
I should also mention that I have no control over what content is loaded into the webview and so I must assume that there is no reference to base.js.
I guess my question is, is there any folder where I can store images on the device that I can access from within a webview.
I have tried:
ms-appdata:///local/
ms-appx-web:///local/
file://[path]
Update
This project is done using WinJS and Universal Apps. So it is written entirely in JavaScript.
I use this :
StorageFile file = await dir.GetFileAsync(name + ".jpg");
and I set this
"ms-appdata:///local/" + file.Name
in the "src" attribute of my image tag.

Desktop Top Save Location For User Storage?

While writing a node-webkit application I came across needing to save users uploaded photos through the built in html file input. I can save photos easy enough where I wish via a nice post here on node file uploading and node-webkit's file dialog changes simple enough.
The question really is there a best practice for saving user generated content for a desktop app or is the application folder (OS specific) reasonable to use with say the application or company name? Security is not much of a concern here in this case.
node-webkit (at this time) has an application folder under under process.env.LOCALAPPPATH (for windows users anyway) which could be used.
Another option which is viable is to use an application directory in the exe directory of the program.
IE for node with process global.
var path = require('path');
var appDir = path.dirname( process.execPath ) + path.sep + 'data' + path.sep;
//might produce something like c:\\programs\\node-webkit\\data\\

Resources