PHP로 본 최신 애니메이션에서 고유 한 포럼 서명을 만들고 싶습니다. 이들은 RSS 피드에 포함되어 있습니다. 내 로컬 아파치 서버에서 이미지가 제대로 생성되지만 서버에 업로드 할 때 오류가 발생하고 그림이 전혀 생성되지 않습니다.내 PHP에서 생성 된 png 파일의 문제점은 무엇입니까?
여기 내 코드가 있습니다. Dreamweaver CS5 또는 phpDesigner 7도 phpDesigner에서 [실행] 버튼을 누르면 오류가 표시되지 않지만 문제는 무엇인지 궁금합니다. 오류는 발생하지만 무엇이 있는지 모르겠습니다. 그 뜻은. 사전에
<?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);
?>
감사 : 그래서 코드는 다음과 같다
Line: 6 - Fatal error: Call to undefined function imagecreatefrompng() in [php's path here]
:이 오류는 다음과 같다.
편집 :
머리글을 제거 했으므로 이제 글꼴 파일을 찾을 수 없다는 오류가 많이 발생하지만 올바르게 작성했는지 확신 할 수 없습니다.
그들은 다음과 같이 :
는Warning: imagettftext() [function.imagettftext]: Could not find/open font in ... on line 19
젠장 ... 나는 그것이 문제라고 생각하지 않지만, 지금 해결되었습니다. : 고마워! –
당신을 진심으로 환영합니다. 내가 할 수있는 또 다른 일은'@imagecreatefrompng (...의 시작 부분에 @ 문자를 넣는 것입니다.)'나쁜 변환 이미지를로드하고 오류 메시지가 표시되어 이미지가 표시되지 않는 경우가 발생할 수 있기 때문에 –
팁 주셔서 감사합니다! ;) –