>OK, i made this image.php file:
> $theFile = "";
> $fcontents = file ('Logo.gif');
> while (list ($line_num, $line) = each ($fcontents)) {
>  $theFile .= $line."\n";
> }
> echo $theFile;
>and I have an html file that does <img src="image.php"> but it just prints
>out a red box with an X, as if image is broken.  I know the image is getting
>read in because I can echo it and its a bunch of garble, just like the jpg
>is if I open it up in notepad.
>Any idead?

You are *ADDING* an extra "\n" for every "\n" in the GIF.

The file() command does not strip off the "\n" characters.

You then loop through each "line" and tack on an extra "\n"


If you take off the extra "\n", I think this script will actually work.

But, while we are at it, why in the world are you treating the GIF as if it
were lines and lines of text, and reading one line at a time?... :-)

And then, to compound your folly, you are taking each "line" as tacking it
onto a HUMONGOUS string variable, which, in the end, you just spew out to
the browser.

Just use http://php.net/readfile or http://php.net/passthrough or whatever
is easiest.

You still just store 'Logo.gif' in your database, though. :-)

Like Music?  http://l-i-e.com/artists.htm

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to