Hi!
I want to make a unique forum signature from my latest watched animes in PHP. These are contained in an RSS feed. On my local apache server, the image is generated well, but as I upload it onto a server, I get an error, the picture isn't generated at all.
Here is my code and I wonder what's the problem since neither Dreamweaver CS5 or phpDesigner 7 don't show any errors, although if I press the Run button in phpDesigner, I get an error, but I don't know what it means. The error is the following:
Line: 6 - Fatal error: Call to undefined function imagecreatefrompng() in [php's path here]
So the code is the following:
<?php
// title & description arrays
$titleCuts = array();
$descCuts = array();
// bg image
$bgimg = imagecreatefrompng('sig_robin.png');
// colors
$white = imagecolorallocate($bgimg, 255, 255, 255);
$textColor = imagecolorallocate($bgimg, 245, 193, 9);
$shapeColor = imagecolorallocate($bgimg, 27, 20, 0);
// sxe <- xml url
$sxe = new SimpleXMLElement('http://myanimelist.net/rss.php?type=rw&u=fema', NULL, TRUE);
// shape
imagefilledrectangle($bgimg, 255, 20, 567, 279, $shapeColor);
// TEXTS
imagettftext($bgimg, 20, 0, 263, 52, $white, "my.ttf", "Latest Watched:");
// episodes' text
for($i=0;$i<5;$i++)
{
// title cut and joint
$titleCuts = explode(' ', $sxe->channel->item[$i]->title, -2);
$titleCut = implode(' ',$titleCuts);
// description (ep) cut and joint
$descCuts = explode(' ', $sxe->channel->item[$i]->description);
// output
imagettftext($bgimg, 10, 0, 270, 77+($i*45), $textColor, "my.ttf", $titleCut);
imagettftext($bgimg, 10, 0, 270+(strlen($titleCut)*7.2), 92+($i*45), $textColor, "my.ttf", "ep. ".$descCuts[2]);
}
header('Content-type: image/png');
// generating image
imagepng($bgimg);
?>
Thanks in advance.
Edit:
As I removed the header, now I get a lot of error that it can't find the font file, but I'm dead sure that I wrote it correctly.
They look like this:
Warning: imagettftext() [function.imagettftext]: Could not find/open font in ... on line 19