Jump to content

how to import an imagepng($im); within my page


jasonc

Recommended Posts

You must use an <img src="the_URL_of_an_image_here" alt=""> HTML tag for each image. You cannot put the raw image data in the middle of HTML.

 

The php code that outputs the content type header followed by the imagepng($im); must be in its' own file and the URL of that file is put into the src="..." attribute of the <img tag.

ok i have added this to my script...

 

$newimage = imagepng($im);  //  previsouly just      imagepng($im);

$temp_folder = "temp_images/";

$randomname = $temp_folder . "temp_image_".rand(10, 999999) . ".png";
while (file_exists($randomname)) {
$randomname = $temp_folder . "temp_image_".rand(10, 999999) . ".png";
}
$fp = fopen($randomname, 'w');
fwrite($fp, $newimage);
fclose($fp);
imagedestroy($im);

 

but now i get the strange characters and not the image on the page.  the image contains only one byte and nothing else.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.