imagearc ()

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kujtim
Forum Commoner
Posts: 35
Joined: Sat Oct 25, 2003 4:00 am
Location: kosovo
Contact:

imagearc ()

Post 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
Gen-ik
DevNet Resident
Posts: 1059
Joined: Mon Aug 12, 2002 7:08 pm
Location: London. UK.

Post 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.
Post Reply