[Seaside] Howto Image (picture) instance variable of the class

Karsten Kusche karsten at heeg.de
Fri Jun 4 05:53:05 UTC 2021


Hi Oswall,

the biggest challenge in serving pictures via FileLibrary is how to map a URL <-> Picture. In HTTP all you have is a URL and you need to find a way to create this URL and then also to resolve your pictures based on a given URL. So if you use a FileLibrary or a similar RequestHandler, you need a way to find your Product object and then find its picture based on a given URL. If this is simple enough in your implementation, go for it. i.e. if your Products all have an ID and your are stored in a database there’s no problem in resolving URLs like /pictures?product=1234&picture=1.

An alternative is to register a URL during rendering (in that case Seaside takes care of creating and resolving the URLs):
html image document: aProduct picture1 data
The benefit is that you don’t need to think about creating a URL and resolving it. The downside is that your images have URLs with random keys in it and they’re only valid as long as your session is alive.

Kind regards
Karsten

—

Georg Heeg eK

Wallstraße 22
06366 Köthen

Tel.: 03496/214328
FAX: 03496/214712
Amtsgericht Dortmund HRA 12812



Am 3. Juni 2021 um 20:52:10, Oswall Verny Arguedas C. (sistecaq at gmail.com<mailto:sistecaq at gmail.com>) schrieb:

Greetings,
I have a query about saving instances of a class that are of type image (picture).
For example. I have a Product class. This class must have two photographs of that product. I have to save two instance variables of the Product class, picture1, picture2.
These images must be uploaded from the Product form and displayed after uploading.
In Seaside what would be the best procedure to do it.
I don't know if WAFileLibrary would be the best option.
Thanks in advance.
Oswall
_______________________________________________
seaside mailing list
seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20210604/815f97c2/attachment.html>


More information about the seaside mailing list