Re: downloading dynamic images
Re: downloading dynamic images
- Subject: Re: downloading dynamic images
- From: Chuck Hill <email@hidden>
- Date: Mon, 12 May 2003 14:53:40 -0700
- Organization: Global Village Consulting, Inc.
Tom Pelaia wrote:
Keeping the images on the webserver doesn't work because our application
is an electronic logbook and the images are added by the users. Users
make hundreds of entries every week. Some of those entries have
multiple images attached. We decided to keep all data associated with
logbook entries (images, attachments and text) in a database. The
logbook works fine and images are consistently displayed correctly by
the web browsers, but some people want to archive pages and the images
don't always download properly. Sometimes they download as "wr" or
"wr.txt" with no data despite the fact the the MIME type is bound.
Other times the very same images will download properly with the proper
suffix. If this is truly a feature of the WOResourceManager intended to
protect intellectual property then it is at best inconsistent.
I would like to try your first suggestion. I'm not sure that I
understand it completely. What is the purpose of using the direct
action?
>
To provide an alternate URL mechanism to access binary data.
The logbook is session based
>
The use of direct actions not *prevent* session based access, but it
does not *require* it.
because we require secure
connections with tracable database access. Thus each user is assigned
an independent database connection rather than using the shared database
connection pool.
>
That must eat a fair bit of memory!
Is it sufficient to bind the "key" property of the
WOImage? Could you clarify the layout for your suggestion? Thanks!
I avoid WOResourceManager so I'm not the person to ask about that. I
recall that doing this requires to you manually remove the image from
the cache when you know it will no longer be needed.
You can serve images with a simple DirectAction like this:
public WOActionResults displayFileAction()
{
// 1. Get information from form values to indentify the file
// 2. Check session() to ensure user is logged in and
// allowed permission
// 3. Get a reference to the file to return
EOEnterpriseObject file = ...
// 4. Return a WOComponent to display the file
DisplayFilePage dfp = pageWithName("DisplayFile");
fdp.setFile(file);
return dfp;
}
If you don't now how to write DisplayFilePage, search the archive for
'download'.
Chuck
Chuck Hill wrote:
Welcome to WOResourceManager! You could even argue that this is a feature
protecting your intellectual property. :-P
A couple of options come to mind. One is to create a direct action to
serve the images based on form values (e.g. name, key etc.) and bind your
images to this. Another is to keep the images under the webserver doc root
and just store the path in the database. The former is better for images
that need a lot of maintenance (upload, replacement etc.), and the latter
is better for images that don't change a lot. The latter is also more
efficient as the webserver will be serving the images.
There are several other ways too.
Chuck
At 04:39 PM 09/05/2003 -0400, Tom Pelaia wrote:
I've noticed a problem copying dynamic images off of WebObjects pages.
If I have a page where I display an image that I get from a database,
the image appears fine on the web page but the user cannot consistently
copy those images from the web page to their desktop or create a web
page archive with the image included. Most of the time the image just
appears with the name "wr" on the desktop and has zero bytes. Sometimes
(even on the very same images) the image will actually be copied
properly including the correct extension.
In the web component that displays the images I allow WebObjects to
assign names to the images.
Has anyone else experienced this problem before and does anyone know of
a solution that works consistently.
thanks,
-tom
--
Tom Pelaia
SNS Project, 701 Scarboro Road, MS-6473, Oak Ridge, TN 37830
phone: (865)574-6421, fax: (865)574-6617
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
Progress is the mother of all problems.
- G. K. Chesterton
_______________________________________________
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.