The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GD Create

Discussion in 'General Discussion' started by adamwebb, Aug 1, 2004.

  1. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Ok, I've compiled PHP with gd support, and according to phpinfo() everything is fine and enabled. and I can use scripts that create an image from scratch but when it comed to using imagefrompng() (I think thats the function) I get a red cross where the image should be. A couple of different scripts that all include an external image as a background have this problem, but like I said, not the ones that create an image from scratch. I've tried recompiling many times but it hasnt helped, any ideas?
     
  2. OCX

    OCX Well-Known Member

    Joined:
    Sep 20, 2003
    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    16
    may have to install libpng
     
  3. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Where do I get that from?
     
  4. ISNScott

    ISNScott Member

    Joined:
    Jul 16, 2004
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    adam its probley justa buggy script if its just showing X , gd is fine because its showing the X and not erroring.

    try a simple example that actualy works, and then give it a shot if it generates its just your "crap" code:D
     
  5. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Actually its PHPnuke 7.4 (infact no versions have ever worked on my sever) and a completely different dynamic script made by someone else and one of the tutorials at PHP Freaks.

    Surely not all of these scripts are buggy? Like I said, GD can create images from scratch easily, just not when using an external image.
     
  6. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Just checked and libpng is already installed. I cant believe that all these scripts (Which work on others servers) dont work on mine (I can add Hivemails registration code to the list now to).

    I really need this running asap, as its stopping many parts of my site working. Is it worth me submitting a support request to CPanel?
     
  7. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Help please, someone?
     
  8. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    yeap, all php scripts
     
  9. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    heres the results of the script:
    http://www.beanwebb.com/gdtest.php
    As I thought it would work because this one creates a image from scratch, its the scripts that try to include an external graphic file when I get the red cross.
     
  10. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    This is the code for the script:
    Code:
    <?php
    
    require_once("mainfile.php");
    require "./modules/Forums/conf_global.php"; //use $INFO['sql_tbl_prefix'] for ipb prefix. note no _ is needed on the table name, prefix has it
    global $prefix, $startdate, $db;
    
    //ONLY EDIT THIS STUFF
    $id = "1"; //Enter YOUR user ID, usually number 1, if you installed the forums with your username as the admin
    $admin = "4"; //Enter the usergroup for the administrators, usually number 4
    $mod = "6"; //Enter the number for the moderators, if it's the first new group you created, it's probably number 6
    $bottom1 = "Mod Status:";//text for the bottom right upper - MAX 15 CHARS
    $bottom2 = "";//text for the bottom right lower - MAX 15 CHARS
    //NO MORE EDITS TO DO 
    
    list($count) = $db->sql_fetchrow($db->sql_query("SELECT count FROM ".$prefix."_counter WHERE type='total' AND var='hits'"));
    list($sitename) = $db->sql_fetchrow($db->sql_query("SELECT sitename FROM ".$prefix."_config")); 
    list($overall) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$prefix."_users"));
    list($lastuser) = $db->sql_fetchrow($db->sql_query("SELECT username FROM ".$prefix."_users order by user_id DESC limit 0,1"));
    list($member_online_num) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$prefix."_session WHERE guest = 0")); 
    list($guest_online_num) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$prefix."_session WHERE guest = 1"));
    list($totaltopics) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$INFO['sql_tbl_prefix']."topics"));
    list($totalposts) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$INFO['sql_tbl_prefix']."posts"));
    list($points) = $db->sql_fetchrow($db->sql_query("SELECT points FROM ".$INFO['sql_tbl_prefix']."members WHERE id='$id'"));
    list($group) = $db->sql_fetchrow($db->sql_query("SELECT mgroup FROM ".$INFO['sql_tbl_prefix']."members WHERE id='$id'"));
    list($myposts) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$INFO['sql_tbl_prefix']."posts WHERE author_name='Freddy'"));
    list($mytopics) = $db->sql_fetchrow($db->sql_query("SELECT COUNT(*) FROM ".$INFO['sql_tbl_prefix']."topics WHERE starter_name='Freddy'"));
    list($modstatus) = $db->sql_fetchrow($db->sql_query("SELECT project_percent FROM ".$prefix."_nsnwb_projects WHERE project_id='3'"));
    if ( $group = "$admin" ) {	$mgroup = "Administrator"; } elseif ($group = "$mod" ) { $mgroup = "Moderator"; } else {	$mgroup = "Member"; }
    if ( $modstatus < 100 ) {	$modstatus2 = "$modstatus% Completed"; } else {	$modstatus2 = "Finished"; }
    $who_online_num = $guest_online_num + $member_online_num;
    $image = "signature.png"; 
    $im = @imagecreatefrompng($image); 
    $org = ImageColorAllocate ($im, 250, 160, 5);  // Orange
    $gld = ImageColorAllocate ($im, 250, 225, 65);  // Gold
    $now = gmdate("M d,Y H:i:s", time() + 3600);
    $white  = ImageColorAllocate ($im, 255, 255, 255); 
    ImageString($im, 3, 80, 2, "$sitename Statistics on $now", $org); 
    Imageline($im, 75, 15, 405, 15, $org); //UNDERLINE
    ImageString($im, 2, 93, 16, "We have received $count page views since $startdate.", $org); 
    ImageString($im, 2, 93, 29, "Total Members: $overall", $org); 
    ImageString($im, 2, 210, 29, "Latest Member: $lastuser", $white); 
    ImageString($im, 2, 93, 42, "Online Now ($who_online_num): $member_online_num members and $guest_online_num visitors.", $org); 
    ImageString($im, 2, 93, 55, "Total Forum Topics: $totaltopics  Total Forum Posts: $totalposts", $org); 
    ImageString($im, 2, 93, 67, "I have posted $mytopics Topics and $myposts posts overall.", $org);
    //RIGHT HAND SIDE NOW
    Imageline($im, 412, 0, 412, 80, $org);
    ImageString($im, 2, 420, 3, "Total Money:", $org);
    ImageString($im, 2, 420, 17, "$points", $gld);
    ImageString($im, 2, 420, 29, "User Type:", $org);
    ImageString($im, 2, 420, 42, "$mgroup", $white);
    ImageString($im, 2, 420, 55, "$bottom1", $org);
    ImageString($im, 2, 420, 67, "$modstatus2", $white);
    header("Content-Type: image/png");
    @header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    @header("Cache-Control: no-cache, must-revalidate");
    @header("Pragma: no-cache");
    Imagepng($im,'',100); 
    ImageDestroy ($im); 
    
    ?>
    
     
  11. stephem

    stephem Member

    Joined:
    Apr 25, 2003
    Messages:
    23
    Likes Received:
    0
    Trophy Points:
    1
    I know very little about GD but it sounds like a path problem. Looking at
    Code:
    $image = "signature.png"; 
    $im = @imagecreatefrompng($image); 
    a couple of things come to mind. Try
    1. putting the complete path to signature.png in case it can't find the png
    2. Remove the @ in front of @imagecreatefrompng. @ suppresses error messages and it might help to see any such messages.
     
  12. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Tried that, still didnt help, any other ideas?
     
  13. OCX

    OCX Well-Known Member

    Joined:
    Sep 20, 2003
    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    16
    only thing i can think of is to reinstall GD (theres a new version by the way)
     
  14. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    How do I go about doing that?
     
  15. OCX

    OCX Well-Known Member

    Joined:
    Sep 20, 2003
    Messages:
    232
    Likes Received:
    0
    Trophy Points:
    16
  16. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Ok done that, but phpinfo still says I have version 2.0.23 installed, with everything enabled, shouldnt this say 2.0.28?
     
  17. adamwebb

    adamwebb Active Member

    Joined:
    May 12, 2004
    Messages:
    37
    Likes Received:
    0
    Trophy Points:
    6
    Any more help?
     
Loading...

Share This Page