|
Posted by -Lost on 06/08/07 02:59
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. : ))
--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Navigation:
[Reply to this message]
|