FRIHOST • FORUMS • SEARCH • FAQ • TOS • BLOGS • COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


A Little PHP GD Help...





isledepoba
I'm working on a dynamic signature generator for myself, about an online game Runescape.
However, it's not working...

Here's the URL of it...
http://yanille.com/sigs/statsig.php?

The form that submits it...
http://yanille.com/sigs/form.php?

And my source code
Code:
<?PHP
require("statsget.php");
header ("Content-type: image/png");
define("BACKDIR","backs");
define("FILEDIR","files");
define("POSEDIR","pose");
$pose = POSEDIR . "/" . $_GET['pose'] . ".png";
$back = BACKDIR . "/" . $_GET['back'] . ".gif";
$font = FILEDIR . "/ v.ttf";
$namefont = FILEDIR . '/namefont.TTF';
$src = array ($back,$pose,"oldstats.png");   
$imgBuf = array ();
foreach ($src as $link)
{
   switch(substr ($link,strrpos ($link,".")+1))
   {
       case 'png':
           $iTmp = imagecreatefrompng($link);
           break;
       case 'gif':
           $iTmp = imagecreatefromgif($link);
           break;               
       case 'jpeg':           
       case 'jpg':
           $iTmp = imagecreatefromjpeg($link);
           break;               
   }
   array_push ($imgBuf,$iTmp);
}
$iOut = imagecreatetruecolor ("300","125") ;
$black = imagecolorallocate($iOut, 0, 0, 0);
imagecopy ($iOut,$imgBuf[0],0,0,0,0,imagesx($imgBuf[0]),imagesy($imgBuf[0]));
imagecopy ($iOut,$imgBuf[1],230,3,0,0,imagesx($imgBuf[1]),imagesy($imgBuf[1]));
imagecopy ($iOut,$imgBuf[2],0,0,0,0,imagesx($imgBuf[2]),imagesy($imgBuf[2]));
imagecopy ($iOut, $imgBuf[3],232,110,0,0,imagesx($imgBuf[3]),imagesy($imgBuf[3]));
//Start to write all the stats. I gotta find a better way to do this...
imagettftext($iOut, 14, 0, 162, 95, $black, $namefont, $user);
imagettftext($iOut, 10, 0, 22, 18, $black, $font, $skills[1][1]);
imagettftext($iOut, 10, 0, 22, 44, $black, $font, $skills[2][1]);
imagettftext($iOut, 10, 0, 22, 70, $black, $font, $skills[3][1]);
imagettftext($iOut, 10, 0, 22, 89, $black, $font, $skills[7][1]);
imagepng($iOut);
?>


It's not done, but well, i would like some help
I keep getting an error
Code:
The image “http://yanille.com/sigs/statsig.php?” cannot be displayed, because it contains errors.

But I can't figure out why. Thanks a ton!
~Isledepoba
mathiaus
Comment out the line header ("Content-type: image/png"); and it should provide a normal error, making finding the problem much easier.
isledepoba
I got it, thanks!
I had an invalid copy method, where the source wasn't there.
Related topics
php script help!
GD Help
php project help needed please
Needing a Bit Og Help {PHP}!
A Bit Of Help Needed :P
PHP - checking lengths
PHP installtion Help!
PHP Layout Help -- URGENT
Uploading a .php file! NEED HELP thanks
PHP-Nuke.. help!
PHP Web Templates
Uplaoding images using php form :::: Help needed
PHP Nuke Help
PHP Scripting HELP
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.