SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2006
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    gd library code not working online

    I have this file to create images for my review system. the top bit thats cut off is the db connection stuff which works correctly.

    PHP Code:
    <?PHP
    $font 
    'test.ttf';
    $font2 'arial.ttf';
    $image "images/signature.png"
    $voters 0;
    $copy2   imagecreatefromgif('images/over.gif');
    $animeid $_GET[animeid];


    $animeinfo mysql_fetch_assoc(db_query("SELECT * FROM info_anime WHERE animeid='".$animeid."'"__FILE____LINE__));
    $a_id=$id;
    $a_name=strtoupper($animeinfo[animename]);
    $a_plot=$animeinfo[plot];
    $a_animation=$animeinfo[animation];
    $a_music=$animeinfo[music];
    $a_voice=$animeinfo[vactors];
    $a_char=$animeinfo[characters];
    $a_seffect=$animeinfo[sound];
    $a_overall=round((($a_plot+$a_animation+$a_music+$a_voice+$a_char+$a_seffect)/6),0);

    $im imagecreatefrompng($image); 
    $tc ImageColorAllocate ($im000); 
    $red ImageColorAllocate ($im25500); 
    $grey ImageColorAllocate ($im150150150); 
    $blue ImageColorAllocate ($im0114255); 
    $green ImageColorAllocate ($im2312417); 
    $dblue ImageColorAllocate ($im1298383); 

    imageCopyMerge($im$copy22302200imageSX($copy2), imageSY($copy2), 100);

    imagettftext($im60710$tc$font"LIVE ANIME'S RATING FOR ".$a_name."");
    imagettftext($im60730$tc$font"PLOT: ");
    imagettftext($im607030$dblue$font"".$a_plot."/10 ");
    imagettftext($im60742$tc$font"ANIMATION: ");
    imagettftext($im607042$dblue$font"".$a_animation."/10 ");
    imagettftext($im60754$tc$font"CHARACTER: ");
    imagettftext($im607054$dblue$font"".$a_char."/10 ");

    imagettftext($im6010030$tc$font"MUSIC: ");
    imagettftext($im6018430$dblue$font"".$a_music."/10 ");
    imagettftext($im6010042$tc$font"VOICE ACTING: ");
    imagettftext($im6018442$dblue$font"".$a_voice."/10 ");
    imagettftext($im6010054$tc$font"SOUND EFFECTS: ");
    imagettftext($im6018454$dblue$font"".$a_seffect."/10 ");

    imagettftext($im30029554$tc$font2$a_overall);
    imagettftext($im30029453$blue$font2$a_overall);









    $total=0;
    $voteing db_query("SELECT * FROM info_quickvote WHERE animeid='".$animeid."'"__FILE____LINE__);

    while(
    $row mysql_fetch_assoc($voteing)) {
    $voters++;
    $total =  ($total $row[score]);
    }



    $total =  ($total round((($a_plot+$a_animation+$a_music+$a_voice+$a_char+$a_seffect)/6),2));
    $voters++;

    $a_overallmain round(($total/$voters),1);


    if (
    $a_overallmain <= 2){
    $copy   imagecreatefromgif('images/t.gif');
    } elseif (
    $a_overallmain && $a_overallmain 5) {
    $copy   imagecreatefromgif('images/r.gif');
    } elseif (
    $a_overallmain >= && $a_overallmain 8) {
    $copy   imagecreatefromgif('images/s.gif');
    } elseif (
    $a_overallmain >= 8) {
    $copy   imagecreatefromgif('images/g.gif');
    }

    if(
    strlen($a_overallmain)=='1'){ $a_overallmain .= '.0';}


    imageCopyMerge($im$copy56700imageSX($copy), imageSY($copy), 100);

    imagettftext($im25039154$tc$font2$a_overallmain.'/10');
    imagettftext($im25039053$blue$font2$a_overallmain.'/10');
    imagettftext($im6039564$red$font" BASED ON ".$voters." VOTERS");

    imagettftext($im6039594$grey$font" HTTP://LIVEANIME.ORG ");




    header("Content-Type: image/png"); 
    Imagepng($im,'',9); 
    ImageDestroy ($im); 
     
     
     
    ?>
    This works perfectly offline but online it just shows a failed image picture. All the files that it requires are uploaded and the server supports GD as it was working before. I havent changed this file in anyway and just wont work all of a sudden. perhaps there is some compatibility issues between php versions????

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Comment out the image header and try to run it again -- see what errors does it show.
    Saul

  3. #3
    SitePoint Enthusiast Dunkel's Avatar
    Join Date
    Jun 2007
    Location
    Mexico
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it could be as a result of having different versions of the GD off-line and online have you checked that?

    I had the same problem some time ago and I didn't find out the solution I just thought that i was because of the version


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •