John,

I typically store the images in a web-accessible directory. I have done this in several different webapps (in several languages for that matter). I typically have a table that holds any data about the image, most importantly, how to contruct a url for an image tag so I can display it on a page. My scheme is generally to store the image with a file name of <record id>.<ext>. My table generally looks something like:

images (id, alt_text, type/file extension [, image dimensions])

This generally contains all I need to be able to display, create, update or delete the image.

The only advantage I see to storing them in a BLOB is the database backup benefit that Mark mentioned. In my case this has not outweighed the simplicity of letting a web server serve images from the filesystem, which it does very well.

Hope this helps,
Colin

[EMAIL PROTECTED] wrote:



My web app will have about 300 users, each of whom will be allowed to
upload a max of 5 images/digital pictures.  I am using the Struts-upload
package.  I considered storing the images in MySQL as blobs, but have read
lots of advice that this is more trouble than it's worth / overkill.
However, I am perplexed (I am a newbie) as to where I should store them on
the file system and then how I would retrieve them and get them displayed
in a browser.  What is a "best practice" for this?

It would be easy to store them in a subdirectory of the web app, which
would allow me to include them in my JSPs with a simple HREF tag.  However,
does this cause problems with the size of the web app, maybe the start-up
and reload speeds of the container, etc.?  I trialed this by storing 1500
images in myWebApp/Pictures, starting Tomcat and retrieving images with a
HREF tag in a JSP.  I didn't notice any impact on startup time or
performance, but I want to make sure I'm not missing some other problem...

If I store them in the filesystem outside of the web app directory
structure, I can't just refer to them in my JSPs with an HREF tag, right?
It would be more work to have an action servlet retrieve the image file and
return it to the browser in the response object.  That seems to be just as
much work as storing them in MySQL, so why not just use MySQL?   What are
your opinions?




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to