Pictures on Xojo Web

I have seen that the internal pictures which the framework is using (ex appicon128.png, pagestop.png, etc…) are available on the same web base URL: /framework/appicon128.png , /framework/pagestop.png . These pictures are stored on internal dictionary inside of Xojo,

When you use webpictures, the URL is different on every session. Is it possible, for all the sessions, the base URL to be the same (/pictures/picturename.png)??? Or can I store the pictures with the same way, that xojo is stored for the framework pictures ?

First off, it would be nice if we could add URL handlers to the web server. That would be a good feature request.

Second, static images, you could serve with a special/api URL:

Base URL:/api/pictures/…

But if they’re truly static, you’ll probably do better having a separate web server, like Apache, serve them up for you. If the pictures are Session specific, you will want to use WebPicture’s ability to restrict access to the Session to which the picture belongs.

to have same URL, you need to set session property of webpicture to nil. This way you can use the same webpicture in several sessions.

There is a feature request for static URLs for images.

<https://xojo.com/issue/30398>

I think this used to work in Real Studio 2011 by setting session to nil.

This does not work here, unless I’ve missed something. I’ve tried several time by setting a WebPicture.Session to Nil but ultimately the picture is sent through the Session URL (checked with FireBug).

The best way I’ve found is to create all your WebPicture at the Application level. Then use HandleSpecialURL as suggested by Brad.

If you have some WebImageView on your page, then instead of setting the Picture, set the URL with something like “/special/images/myimage.png”. Then Select Case the Request.Path in the App.HandleSpecialURL and send back Request.Print( App.myWebPicture.Data ).

This works perfectly well.

Cheers,
Guy.

From debugging , I saw that that Xojo is using a dictionary to store the framework images. Is it possible to access it ?

it used to work, but it doesn’t in 2012 to 2014, I think.
So my request would be to make it available again.
e.g. if session = nil use not session ID but some other text like “globals” in URL.
This way images can be cached better.

What session=nil is supposed to do is allow other sessions to access the image. It doesn’t retain the image for you or make the URL pretty. You’ll need to save a reference somewhere that persists beyond the session.