Reply to Re: outputing image directly to browser

Your name:

Reply:


Posted by Jon Slaughter on 06/08/07 06:06

"-Lost" <maventheextrawords@techie.com> wrote in message
news:U8mdndSCuNxXWPXbnZ2dnUVZ_rfinZ2d@comcast.com...
> Jon Slaughter wrote:
>> can one "stream" image data to a browser?
>>
>> I created an image using gd and when I do imagepng I just get the binary
>> data for the image written as text instead of the image itself. Now I'm
>> writing the file to a temp file and using html to load the temp but seems
>> like a waste of cycles and space ;/
>>
>> Anyway around this?
>
> Basically, exactly what Ivαn Sαnchez Ortega said.
>
> Remember that GD example source code I gave you a few days ago? All you
> have to do is put it in a file, for example "image.php."
>
> Then in another file, perhaps an HTML document, use:
>
> <img src="image.php" width="100" height="100" />
>
> Assuming your actual image output is 100x100.
>
> In this same fashion, if you pass parameters to the image.php script to
> say output specific characters you can do:
>
> imagestring($img, 10, 5, 5, $_POST['msg'], $fg);
>
> Instead of:
> $msg = " Your IP is {$_SERVER['REMOTE_ADDR']}";
> imagestring($img, 10, 5, 5, $msg, $fg);
>
>
> <img src="image.php?msg=Jon_SlaughterREMOVE@REMOVEHotmail.com" alt="E-mail
> John Slaughter" width="100" height="100" />
>
> <img src="image.php?msg=alternateEmail@hotmail.com" alt="My Alternate
> E-mail" width="100" height="20" />
>
> Of course, remove the REMOVEs. I just put that there in case of
> harvesting.
>
> (Yes, yes, I realize they could harvest it anyway, since you do not
> disguise it. I was just trying to be nice. : ))
>

Strange... my image is true color and I get an error about the image having
an error when its true color but works when I use imagecreate as in your
example or the one in the php manual... ;/ Do I have the wrong mime type or
is can I not use this method with true color? (was saving to a png file and
then loading that with <img> and it worked fine)

Thanks,
Jon

[Back to original 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

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация