Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display a gif using the code;not the actual gif file.

Status
Not open for further replies.

pollux0

IS-IT--Management
Joined
Mar 20, 2002
Messages
262
Location
US
mabey i am doing this the wrong way...i am trying to display an image(gif) on a web page using the actual code of the image(the code you get when you open up an image with a text editor). the long code is stored in a variable in php...i believe it is probably some advanced html tag or something like <a href=&quot;data:eargoiajergojaeorgoergjoaeijrgg94u3t3tt/q45yo45jyklerjgke...&quot;>

thanks in advance
 
I doubt HTML lets you do it like this at all, though if you can get the raw data, you can try to make use of the .mht web archive way of doing it, where you give it a special value for the src property of the img tag and dump the image data at the end of the file.

btw, <a href=&quot;foo&quot;> is for hyperlinks, <img src=&quot;bar&quot;> is for images.
 
pollux0,

Would you mind telling us why you want to display the raw data?

Or do you want to send the data as a stream rather than refering to a file?
 
i am trying to parse and display an email. If you look at the actual code for an email the image is sent as a steam of code.

thanks
 
I think he wants to show the image, but not leave an address visible, so the user can't tell where it came from. Not a security risk as far as I can tell, because it's only the image data, nothing else.
 
thanks KempCGDR my mistake! <img src=data:gargagr...>

I have actually been successful in displaying the image using the base64 decoded &quot;gif code&quot; in a php page. This was done simply by typing &quot;echo $gifCode;&quot; However nothing ele shows up on the page. Furthermore it only works is it is echoed before the html tag <html>. If i type &quot;echo $gifCode;&quot; after the <html> tag the code shows up on the page..not the image.

thnaks in advance.
 
I think if you echo it before the <html> tag then the browser thinks it's looking at a picture, so it shows that, then anything after it is treated as garbage and ignored. I would suggest using the .mht style format, I'll do some work on the actual format you need to use and get back to you.
 
Ok, here you go, this is just me posting what IE puts in .mht files, so I can't guarantee I got it right.


At the top you have

From: <Saved by Microsoft Internet Explorer 5>
Subject: =?Windows-1252?Q?*************************?=
=?Windows-1252?Q?s=99?=
Date: Tue, 1 Jul 2003 11:23:20 +0100
MIME-Version: 1.0
Content-Type: multipart/related;
boundary=&quot;----=_NextPart_000_0000_01C33FC3.2D619B90&quot;;
type=&quot;text/html&quot;
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2727.1300

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C33FC3.2D619B90
Content-Type: text/html;
charset=&quot;iso-8859-1&quot;
Content-Transfer-Encoding: quoted-printable
Content-Location: ##########################


Replace the **************** with the title of the page with all spaces changed to underscores (_). Replace ################# with the address of the page. Change the date to the right date. Should be able to leave the rest as-is.

Then leave a line, then all of the html as normal. Then leave a line and then a series of sections in the format below:

------=_NextPart_000_0000_01C33FC3.2D619B90
Content-Type: image/gif
Content-Transfer-Encoding: base64
Content-Location: ####################

*************************************

Replace ############# with the original address of the image and ****************** with the actual image data. Leave a line then do the next image and so on.


You may have to play around to get it to work, and it may not work at all. I definately need to play with this. New toy! Yay!
 
OK, my advice with this is make a very simple html page and then save it as a .mht file and see what it does. Some changes to what I put above based on my experiments:

Subject: =?Windows-1252?Q?*************************?=
=?Windows-1252?Q?s=99?=

Can just be

Subject: ***********************

Your image tags have to be of the form

<IMG = height=3D240=20 src=3D&quot; = width=3D320>

to give the equivalent of

<IMG height=240
src=&quot; width=320>

no idea what most of that does.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top