Hopefully someone with a better understanding of images and Picture / WebPicture handling in Xojo web can help me out here.
I have a web app that has a WebListBox that has multiple columns. The first column is an image.
I use WebListBoxImageRenderer to load the image into the column and if I use an image stored in the project as the source, it works exactly as expected.
However, what I really want to do is load the image from a database, so it arrives, so to speak, as a Picture, which I convert to a WebPicture before trying to load into the WebListBox cell. That doesn’t work though. Looking at the URL of the WebPicture it is well-formed in the first project based scenario, but in the DB sourced scenario, the image filename in the URL has been changed to “picture” every time.
Here’s a copy of the code I have been using…
// Initialization
Var img As New image
Var webpictureTemp As WebPicture
Var pictureTemp As Picture
pictureTemp = img.AssignImage(“KitchenSink”) ’ Get the picture from the DB
// ****** NOT WORKING *********
PictureImageViewer.Picture = pictureTemp
webpictureTemp = pictureTemp ’ ****** NOT THE RIGHT WAY TO DO THIS? ******
Log(CurrentMethodName, webpictureTemp.URL)
pic.URL = webpictureTemp.URL ’ link to the embedded pic
ListsList.CellValueAt(1,0) = pic
// **********************************
// ********** WORKING *************
webpictureTemp = KitchenSink_64 ’ Get the picture from the Project
WebPictureImageViewer.Picture = webpictureTemp
Log(CurrentMethodName, webpictureTemp.URL)
pic.URL = webpictureTemp.URL ’ link to the embedded pic
ListsList.CellValueAt(1,0) = pic
// **********************************
In both cases, the images are valid in the Picture and WebPicture variables, as can be seen when I load them into the WebImageViewers:
Here’s a view into what the URL’s look like from the Log statements above:
/389…2F2/files/679…420/picture.png
/389…2F2/files/729…843/KitchenSink_64.png
Can anyone explain why the picture filename is being replaced with the word “picture”? Anyone know a way around this so I can use a DB sourced image rather than having to load all of my image icons (there are many!) into the project itself.