Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Passing an image object through SiteHTML?

Quote Reply
Passing an image object through SiteHTML?
Hi,

Can anyone tell me if this is possible?

What I would like to do is pass an image object through SiteHTML (or anything that will work) and have it displayed in the page by replacing the given tag (Photo) below.

This is what I've got below, but the image is coming up all garbeled "N'x)r?eýœ&3œ" so there's something wrong with the headers I'm guessing.

Does anyone know if it's possible, or where I can set it right?

# return page with preview img in it
print $IN->header();
print Links::SiteHTML::display('preview', {%$rec, Photo => "$img"});
return;

Cheers,
Regan.

Quote Reply
Re: Passing an image object through SiteHTML? In reply to
You need to specify the IMAGE content type in the following codes:

Code:

print $IN->header();


Like the following:

Code:

print $IN->header('image/gif');


Regards,

Eliot Lee Wink
http://anthrotech.com/
Quote Reply
Re: Passing an image object through SiteHTML? In reply to
Hi Eliot,

I just tried...

print $IN->header('image/jpeg');

but instead of dislaying the whole page with the image as part of it, it just dislpays a broken image icon and nothing else :(

Another piece of information which may be useful, the reference to an image object is one created from the GD command $image->jpeg(80) - thats what I'm working with.

What I'm trying to do (if it's possible), is display the image in a page that's been parsed through Links without actually writing the image file to disk.

Any other ideas?

Cheers,
Regan.

Quote Reply
Re: Passing an image object through SiteHTML? In reply to
Hi,

You need to make a separate call for the image. So on the preview page, you need:

<img src="image.cgi?image=...">

where image.cgi does:

print $IN->header('image/jpg');
print $img;

Cheers,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: Passing an image object through SiteHTML? In reply to
Hi Alex,

Thanks for that - I thought that might be the answer. I was trying to get tricky and see if it could do it all within the one script, and without any second call.

Ahhhhhh well..... :)

Regan.


Quote Reply
Re: Passing an image object through SiteHTML? In reply to
Hi,

Well, if you don't want to display any html, you can. =) i.e. have the image displayed in a popup by itself. Then you just print the image/jpg header and print the image.

Cheers,

Alex

--
Gossamer Threads Inc.