You are here: Image Creation « PHP « IT news, forums, messages
Image Creation

Posted by Aaron Todd on 10/04/93 11:08

I just wrote a little script to play around with the GD library but I am
having a problem displaying it in the browser. I have not problem at all
when I just run the script. But I was trying to make the image in a custom
function which will return the image when its called. All I end up getting
is a bunch of weird characters.

Here's my code:
function makepie($slice, $total){
$height = 150;
$width = 150;
$im = ImageCreate($width, $height);
$bck = ImageColorAllocate($im, 255,255,255);
$black = ImageColorAllocate($im, 0, 0, 0);
$red = ImageColorAllocate($im, 255, 0, 0);
imagefilledellipse($im, 75, 75, 125, 125, $red);
imageellipse($im, 75, 75, 125, 125, $black);

//Making the Slice
$pieslice = (($slice / $total) * 360) + 315;
imagefilledarc($im, 75, 75, 125, 125, 315, $pieslice, $black,
IMG_ARC_PIE);

//Return
header("Content-type: image/png");
echo ImagePNG($im);
}

Anyone have any idea why I cant return the image?

Thanks

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация