You are here: Re: Img src Code works in Firefox but broken in IE « PHP Language « IT news, forums, messages
Re: Img src Code works in Firefox but broken in IE

Posted by Stefan Rybacki on 09/05/05 11:27

JP wrote:
> Hi,
>
> I need to use the <img src tag to output a variable of an image and so I
> borrowed a piece of code I found on the php.net website under the
> documentation for the function base64_encode().
>
> http://uk2.php.net/manual/en/function.base64-encode.php
>
> This worked perfectly well under firefox but I just get a broken image
> using Internet Explorer. I looked again and on the php.net website
> (again under the base64_encode() notes someone stated ...
>
> "To embed binary contents in ascii text based html file for IE, you need
> use MIME multipart."
>
> Does anyone know how to do this.
>
> Cheers
>
> JP
>
> //Code that works under firefox but breaks IE
> <?
> //get a thumbnail from a mysql database into a variable
> $thumbnail_image = $row['thumb_image'] ; //
>
> //encode the variable
> $encoded = chunk_split(base64_encode($thumbnail_image));
>
> //then echo to browser as:
> echo '<img src="data:image/png;base64,'.$encoded.' ">';
> ?>

Why this complicated? Just store the image into a temporary folder or similar and link to it.

echo '<img src="temp/pic.png">';

Stefan

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация