I have a subfile that holds images in a column. When the subfile loads, it seems to only load the last image in the database, setting all of the image widgets in the subfile to that last image loaded. How can I load all of the images in the database into the subfile?
Thanks.
Images loading in subfile
-
- New User
- Posts: 10
- Joined: Tue Mar 26, 2019 11:23 am
- First Name: Kenya
- Last Name: Foster
- Company Name: Amports, Inc.
- State / Province: Maryland
- Country: United States
- Contact:
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Images loading in subfile
The only time I've seen this before is when the RPG program is writing the same path to all records. Debug your program and make sure the proper path is set when you do a WRITE or UPDATE to the subfile record for each record.
-
- New User
- Posts: 10
- Joined: Tue Mar 26, 2019 11:23 am
- First Name: Kenya
- Last Name: Foster
- Company Name: Amports, Inc.
- State / Province: Maryland
- Country: United States
- Contact:
Re: Images loading in subfile
Weirdly, when I bind the image source to the field of the image path, the image does not show. But when I created a field outside of the subfile and set the field to the field which holds the image path, each record shows the image as the last taken path. Are the images loading after the file is read?
Thanks.
Thanks.
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Images loading in subfile
Perhaps the image path is wrong? Normally, this is exactly what people do, they bind the image source property to a server-side (RPG, etc) field that contains the URL (or the path portion of the url) that points to the image.kfoster wrote:Weirdly, when I bind the image source to the field of the image path, the image does not show.
I'm not completely sure that I follow that..? So you have another widget on the screen that is bound to a field, and you copy that field value to all of the subfile rows? Obviously, this would make them all the same, since there's only one field that you're copying into all of the rows.kfoster wrote:But when I created a field outside of the subfile and set the field to the field which holds the image path, each record shows the image as the last taken path.
Not sure what file you're referring to as being "read", here. But, the answer is almost certainly "yes". Profound UI does not load the the images, it merely creates HTML data that's sent to the browser. in HTML, you say that something is an image, and then you give a URL to its source. (Thus the property name 'image source') The browser fetches the URL and shows the image on the screen.kfoster wrote:Are the images loading after the file is read?
So when you write your subfile, you are writing the URL to the images. After the grid is shown on the screen, the browser fetches these URLs and draws the images.
I'm not understanding how that relates to the symptom of seeing only the last image, though... unless... are you loading one image at a time into an IFS filename,. then writing that filename, then replacing the same filename with the next image, etc? If so, then it makes perfect sense that this wouldn't work.
-
- New User
- Posts: 10
- Joined: Tue Mar 26, 2019 11:23 am
- First Name: Kenya
- Last Name: Foster
- Company Name: Amports, Inc.
- State / Province: Maryland
- Country: United States
- Contact:
Re: Images loading in subfile
Yes, I have image paths saved in a database. Each record has a different image path where when each record is read, the path is saved to a field on the display screen. I was advised by support to set the image source of the image widget to script:pui.downloadURL({ "id" : getElementValue(""), "contentType": "image/jpeg" });. This does produce an image for the records, but the image for all of the records displayed in the subfile is the last image record that was read in the database. I believe the images are loading after the screen is loaded instead of the images loading with the subfile. Since the image paths are being set to the same field and changing for every record, when the screen is loaded, it is taking what the field contains, which is the last image record that was read, and loading that into the subfile.
-
- New User
- Posts: 10
- Joined: Tue Mar 26, 2019 11:23 am
- First Name: Kenya
- Last Name: Foster
- Company Name: Amports, Inc.
- State / Province: Maryland
- Country: United States
- Contact:
Re: Images loading in subfile
Its working now. I created a subdirectory under the profoundui directory and it works! :)
Thanks for your help!
Thanks for your help!
-
- Profound User
- Posts: 42
- Joined: Wed Jun 14, 2017 12:06 pm
- First Name: Dan
- Last Name: Devoe
- Company Name: Boston Warehouse Trading
- State / Province: Massachusetts
- Zip / Postal Code: 02062
- Country: United States
- Contact:
Re: Images loading in subfile
Rather then copying the images that you need, if you create a symbolic link (using ADDLNK from command line, or other methods), you can have a directory "point" to somewhere outside of the profoundui directory, which means that you won't need to have multiple copies of the images. Of course this may not be the best approach in your shop, but thought I'd point it out.Its working now. I created a subdirectory under the profoundui directory and it works! :)
Please see https://www.profoundlogic.com/forum/vie ... 220#p11031 for screenshot
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
Re: Images loading in subfile
That's a whole different animal.
If you're putting your images under 'profoundui', they will be publicly available. Anyone can access them without a userid/password. Is that okay?
If so, I highly recommend that you either put them in your own directory beneath 'htdocs' (i.e. outside of profoundui directory that's beneath htdocs) or if you must put it within profoundui, then put it beneath 'userdata'.
I guess a symlink would also work by default, but I'm not sure if I recommend that. Its more secure, IMHO, to add an alias to httpd.conf that points to the directory.
The reason you'd use pui.download() instead is because it does use the signed-in user's authority. This way you can secure things by object-level security. (You can also add additional secvurity within the exit program.) It is much more secure, which would be important if you don't want the public to be able to access the images, but only signed-in users.
pui.download() should work fine, but you have to
1) Make sure your getElementValue() references the id widget in the same grid row. (You didn't say what id it is referencing.)
2) Make sure that the widget that you're getting the id from was rendered prior to the image widget. (the script: code runs while the widget is being rendered, so if the getElementValue() references something that hasn't yet been rendered, you'll just get blanks)
If you're putting your images under 'profoundui', they will be publicly available. Anyone can access them without a userid/password. Is that okay?
If so, I highly recommend that you either put them in your own directory beneath 'htdocs' (i.e. outside of profoundui directory that's beneath htdocs) or if you must put it within profoundui, then put it beneath 'userdata'.
I guess a symlink would also work by default, but I'm not sure if I recommend that. Its more secure, IMHO, to add an alias to httpd.conf that points to the directory.
The reason you'd use pui.download() instead is because it does use the signed-in user's authority. This way you can secure things by object-level security. (You can also add additional secvurity within the exit program.) It is much more secure, which would be important if you don't want the public to be able to access the images, but only signed-in users.
pui.download() should work fine, but you have to
1) Make sure your getElementValue() references the id widget in the same grid row. (You didn't say what id it is referencing.)
2) Make sure that the widget that you're getting the id from was rendered prior to the image widget. (the script: code runs while the widget is being rendered, so if the getElementValue() references something that hasn't yet been rendered, you'll just get blanks)
Who is online
Users browsing this forum: No registered users and 0 guests