Hi,
The solution from
patel_vijay is correct, but there are some points to be aware of:
- if you have lots of images, the resulting html-document will be huge
- if the data is directly rendered into the html-document, the browser have no chance of deciding wether it should load the images or not
- this could led to a slow-buildup of your page in a browser with a slower internet connection
In my opinion, a better solution would be to deliver only image ID's and create an image-controller and a action to deliver a single image.
If you have all your images stored in a database, keep in mind that every single image-action call will cause a DB-connection. So here I would implement some caching mechanism to store the already loaded images in memory or on disk. Additionaly, you can preload the images from the DB (as you do it currently by getting all images in one recordset) if you already know which images must be delivered soon.
Hope this helps.
Best regards and as always: happy coding,
Chris