turbine-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lester Ward <lw...@tagaudit.com>
Subject RE: Storing Images
Date Tue, 06 May 2003 13:29:20 GMT
>     This is not a question which is related to Turbine.
> We need to store images for every record in a table.Currently 
> we were giving the images unique name and storing the name in 
> the Table column, wheras we were uploading the file in a 
> predefined folder.
>     Can someone on the list suggest a better solution, 
> something which is independent of the number of appservers.

Store them in the database. Create a new table called "images" or something
similar. It needs at least three fields: id, filename, data. The data should
be a BLOB field.

Remove the filename field from your existing table, replacing it with the an
image_id field that references the new "images" table.

You can serve the images several ways, including these:

1) When your application starts, walk the new images table and dump each
image in it to the images directory on that server, overwriting any that are
already there with the same names. This is somewhat costly at startup, but
you will not have to change anything else in the system; images will
continue to work as they have been.


2) Create a new servlet and set it up to be called when someone requests and
image file (or, if possible, just image URLs that have a pattern that
indicates they are part of this table). Have this servlet read the image
stream from the database and return it directly.


3) Some other method.

I'd recommend method 1, has generally startup time on a web application is
of no major importance and it allows web caching to work as normal.

Note that both of these systems can be modified slightly to support images
in multiple languages (or even just branding or skins). If you are going
through the trouble of changing the imaging system, you might want to
consider if such features would be worth building in.

To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org

View raw message