Re: Retrieving and displaying images
Re: Retrieving and displaying images
- Subject: Re: Retrieving and displaying images
- From: Chuck Hill <email@hidden>
- Date: Mon, 9 Apr 2007 20:21:50 -0700
On Apr 9, 2007, at 7:54 PM, Janine Sisk wrote:
Ok, on to the next problem.
I have two images I've stored in the database, an original and its
thumbnail. I know the data in the database is good; I can
download them via FrontBase Manager and look at them in Preview.
However, when I try to display the thumbnail in my component like so:
Thumbnail : WOImage {
data = aPanel.images.thumbnail;
mimeType = "image/jpeg";
}
All I get is the missing image marker.
The first thing to do in cases like this is to add the magical,
mystery WODebug binding:
Thumbnail : WOImage {
data = aPanel.images.thumbnail;
mimeType = "image/jpeg";
WODebug = true;
}
Now this is not as magical as the WOJustWorkDammit = true; binding,
but it will dump out the values that are pushed to / pulled from each
binding. At least you can see if data is null or something else.
The String fields in aPanel are displaying, so I know things are
generally working, just not the images. BTW, images is the name of
the relationship between two EOModels.
A to-one or to-many relationship? I am guessing a to-one but it is a
rather confusing name for a to-one. Being plural and all. If it is
a to-many, then aPanel.images.thumbnail is returning an NSArray of
NSData objects. Certainly not what you want here.
Do I have to do something to get the "foreign" items to fetch? I
tried checking the "perform deep inheritance fetch" box in
EOModeler, since that sounded vaguely relevant, but it didn't help.
It should "just go". Try and turn on SQL logging to see if it is
just going or not. There might be a mismatch between the models that
makes EOF think there is nothing at aPanel.images.
After I get past that, I have two more things I'm stumped on, might
as well get them in the queue now:
1. I want to display the thumbnail as a hyperlink which will take
the user to the bigger image. I'm unsure of what to use as the
action of the hyperlink, to return the big image.
Assuming you want the larger image to display in a page by itself (as
opposed to some AJAX-y in-place update, what you want is a link to
download the image. The wiki will light that way.
2. Right now I have these fields in a WORepetition. I want to
eventually have them display in rows of six across. I'm sure I can
work out a way to do this with a counter, spitting out the closing
and opening tr tag every six items. Is there a more sophisticated
way to do this?
CSS, float: left, and a width. Google knows.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden