| 
	
 | 
 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] 
 |