Page 1 of 1

imagearc ()

Posted: Fri Jan 09, 2004 9:30 am
by kujtim
header ("Content-type: image/png");
$im=imagecreate(200,100);
$white=imagecolorallocate($im,255,255,255);
imagecolortransparent($im,$white); // Making Image Transparent
$lightblue=imagecolorallocate($im,20,93,233);
imagearc($im,0,0,199,95,10,180,$lightblue);
imagepng($im);
imagedestroy($im);

can i write some thing else istead of header ("Content-type: image/png");
because the header is not working ....

and i dont now to much abut it

Posted: Fri Jan 09, 2004 8:07 pm
by Gen-ik
Are you sure it's the Header() that's not working and not your code?

A header is a header and all it does is tell the browser what sort of content it should display, if your code isn't building the image correctly then it won't be displayed.

See if this works...

Code: Select all

<?php

ob_start(); // Start a buffer
$im=imagecreate(200,100); 
$white=imagecolorallocate($im,255,255,255); 
imagecolortransparent($im,$white); // Making Image Transparent 
$lightblue=imagecolorallocate($im,20,93,233); 
imagearc($im,0,0,199,95,10,180,$lightblue); 
header("Content-type: image/png"); 
imagepng($im); 
imagedestroy($im); 
ob_end_flush(); // Stop buffering and output contents

?>
Also if you are running the script withing an <img> tag (or something similar) try running the page on it's own (like a normal page), that way you will see if any errors are being displayed.