Re: Advice on dynamic graphics with WO
Re: Advice on dynamic graphics with WO
- Subject: Re: Advice on dynamic graphics with WO
- From: Robert Walker <email@hidden>
- Date: Wed, 31 Dec 2003 19:46:08 -0500
It seems that different people have different opinions on this topic.
I've followed several threads on this and I still haven't come to a
conclusion on the best design pattern.
I wouldn't want to put the images in a share point on the network with
a link to the image directory. That would create a single point of
failure. If you lose the connection to the box storing the images, for
any reason, then you have no access to the images. With images stored
in the database you can use database clustering to provide some
redundancy and fail-over support.
In either case you will be transporting the binary data for the images
across the network either directly via a share, or through the database
connection.
I personally take the easy way out and store the images in the database.
An Example:
Say I have a Product entity and want to upload and store product
photos: I would create two entities Product and ProductPhoto.
I would then relate them with either a toOne or toMany relationship
depending on whether I need one or many ProductPhoto objects for each
Product object.
With this design pattern fetching Product data doesn't directly load
the images. Instead EOF will create faults representing the images.
The image data isn't fetched until the fault is fired by accessing the
ProductPhoto fault object. So If you fetch 500 Products and batch them
into groups of 10 with the WODisplayGroup then your first page would
fetch only the first 10 images not the 500 (and only if there is a
WOElement or method that accesses the image data).
This pattern also greatly simplify uploading and storing the images
because you can bind the NSData used to upload the image to your
ProductPhoto's imageData BLOB.
It's probable that many on this list will disagree with me on this
issue, but I have had good success, for my purposes, with this design
pattern.
You can find an implementation of this design pattern for both toOne
and toMany photos in the JavaRealEstate framework example in
/Developer/Examples/JavaWebObjects/Frameworks.
On Dec 31, 2003, at 5:51 PM, Michael Engelhart wrote:
> This is generally a bad idea in my opinion. There's much more
> overhead in retrieving image data from a database then there is in
> just letting Apache serve up the image. Apache has been highly
> optimized just for this purpose. Databases generally have not.
>
> My suggestion is to just store a URL for the image in the database and
> write that URL to the dynamic page. Or if you know the path is
> always going to be the same you could simply store the filename.
>
> Mike
> On Dec 31, 2003, at 4:52 PM, Kieran Kelleher wrote:
>
>> I know that Apache is the way to go for vending static page graphics
>> that have been designed into my HTML pages, however, should I be
>> storing variable graphics, such as dynamic page graphics (database
>> photos, artwork files, etc.) in my database?
>>
>> Has anyone got a strategy on how to handle this? Is this a feasible
>> strategy: Put a single "VariableDocs" directory on my network with a
>> symbolic link to it in the web server Apache Documents folder, so
>> that I only have to write once to one folder and multiple web servers
>> will see the graphic files via the symbolic link ("shortcut")?? .....
>> any and all advice is appreciated.
>>
>> -Kieran
> _______________________________________________
> webobjects-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/webobjects-dev
> Do not post admin requests to the list. They will be ignored.
>
>
--
Sincerely,
Robert Walker
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.