Having trouble with scripts. Fatal error: Call to undefined function: imagegif()

This is a discussion on "Having trouble with scripts. Fatal error: Call to undefined function: imagegif()" within the PHP Forum section. This forum, and the thread "Having trouble with scripts. Fatal error: Call to undefined function: imagegif() are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Jan 4th, 2006, 14:02
New Member
Join Date: Jan 2006
Age: 21
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Having trouble with scripts. Fatal error: Call to undefined function: imagegif()

hi i am trying to make one of those buy a pixel websites and finding it very dificult getting the scripts working. I have uploaded them all to my server and set the chmodd to 777 for the folder which will hold the ads. I am getting the following error message :

Fatal error: Call to undefined function: imagegif() in /home/www/andcar12.mybesthost.com/libraries/functions.lib.php on line 185

Also my homepage doesnt display the grid. it just leaves a border and a small white icon with a cross in it.

Please help guys im really stuck. cheers cargi
Reply With Quote

  #2 (permalink)  
Old Jan 5th, 2006, 00:22
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Re: Having trouble with scripts. Fatal error: Call to undefined function: imagegif()

Show us the code
Reply With Quote
  #3 (permalink)  
Old Jan 5th, 2006, 15:01
Reputable Member
Join Date: Jul 2005
Location: Melksham, Wilts, UK
Posts: 293
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Having trouble with scripts. Fatal error: Call to undefined function: imagegif()

Do you have the GD library, and the right version, loaded with your PHP? If you put up a web page that's just

<?php phpinfo(); ?>

you'll get a report telling you all about your settings.

Also, from the PHP manual ...

Note: Since all GIF support was removed from the GD library in version 1.6, this function is not available if you are using that version of the GD library. Support is expected to return in a version subsequent to the rerelease ofGIF support in the GD library ...
Reply With Quote
  #4 (permalink)  
Old Jan 6th, 2006, 18:17
New Member
Join Date: Jan 2006
Age: 21
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Having trouble with scripts. Fatal error: Call to undefined function: imagegif()

Hi guys i have now changed hosts and the previous problem has been resolved, although now i have a new problem :


Warning: imagegif(): supplied argument is not a valid Image resource in /mounted-storage/home10/sub001/sc15912-ONEF/www/libraries/functions.lib.php on line 185

any ideas on this one? unlike before all the grid shows up and when an image is selected to be uploaded it adds up its pixels and gives the cost of the advert, but then that error appears above it. cheers cargi
Reply With Quote
  #5 (permalink)  
Old Jan 6th, 2006, 18:55
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Re: Having trouble with scripts. Fatal error: Call to undefined function: imagegif()

show us the code again
Reply With Quote
  #6 (permalink)  
Old Jan 6th, 2006, 18:59
New Member
Join Date: Jan 2006
Age: 21
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Having trouble with scripts. Fatal error: Call to undefined function: imagegif()

hi heres the code with the problem in (as stated by the error anyways)
Code: Select all
<?php
ob_start();
if ($cfg['memory_limit'])
 ini_set('memory_limit',$cfg['memory_limit']);

// Set up database connection
$db = new db;
$db->connect($cfg['db_host'],$cfg['db_user'],$cfg['db_pass'],$cfg['db_name']);
$timestamp = date("YmdHis");

$status_array = array(
'R' => 'Reserved',
'P' => 'Paid'
);
/*
* Build pixel links
*/
function link_array() {
 global $cfg;
 $grid_array = grid_array();
?>
 <img src="grid.php" width="1000" height="1000" usemap="#image-map" border="0">
    <map name="image-map">
<?php
 if ($grid_array) {
  // Patch Details
     foreach ($grid_array as $id => $value) {
      // Explode patch details
   $value = explode ("|",$value);
         switch ($value[5]) {
          case 'P':
        // Get image dimensions
           $file_size = getimagesize($cfg['upload_path'].$value[4]);
?>
<area shape="rect" coords="<?php echo ($value[0]); ?>,<?php echo ($value[1]); ?>,<?php echo ($value[0]+$file_size[0]); ?>,<?php echo ($value[1]+$file_size[1]); ?>" href="url.php?id=<?php echo $id; ?>" title="<?php echo $value[7]; ?>" target="_blank">
<?php
             break;
         }
     }
    }
?>
    </map>
<?php
}

/*
* Check user session
*/
function is_user_session() {
 session_start();
 if ($_SESSION['sess_user'] and $_SESSION['sess_id'])
  return true;
    else
     return false;
}
/*
* Check email is valid
*/
function is_email($email) {
 if (ereg("[[:alnum:]]+@[[:alnum:]]+\.[[:alnum:]]+", $email))
  return true;
 else
  return false;
}
/*
* Check url is valid
*/
function is_url($url) {
 if (!preg_match('#^http\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $url))
  return false;
 else
  return true;
}
/*
* Grid array
*/
function grid_array() {
 global $db,$cfg;
 $query = $db->query("SELECT * FROM ".$cfg['adverts']."");
 while ($result = $db->fetch_array($query)) {
$grid_array[$result['id']] = $result['x'].'|'.$result['y'].'|'.$result['width'].'|'.$result['height'].'|'.$result['image'].'|'.$result['status'].'|'.$result['url'].'|'.$result['title'];
    }
return $grid_array;
}
/*
* Global email
*/
function send_email($email,$subject,$message) {
 global $cfg;
 // Set HTML Mail Headers
 $headers  = "MIME-Version: 1.0\r\n";
 $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
 $headers .= "From: ".$cfg['site_email']."\r\n";
 $headers .= "Reply-To: ".$cfg['site_email']."\r\n";
 // Send email
 mail($email,$subject,$message,$headers);
}

/*
* Shorten string
*/
function shrstr($string, $num="50") {
 // Check string length if grater then $num
 if (strlen($string) > $num) {
     // Shorten the string with ...
  $string  = substr( $string, 0, $num-2);
  $string .= "...";
  return $string;
 } else {
        // If $num is less then
  return $string;
 }
}
/*
* Convert timestamp
*/
function date_format($date,$format) {
 $year = substr($date,0,4);
 $month = substr($date,4,2);
  $day = substr($date,6,2);
 $hour = substr($date,8,2);
 $minute = substr($date,10,2);
return date($format,mktime($hour,$minute,0,$month,$day,$year));
}

/*
* Convert all files supporting ext.
*/
function convert_file_jpg($image,$ext) {
 global $cfg;
    // Check the extension of the file
 if ($ext == "jpg") {
     // Create new image from JPG
  $src = imagecreatefromjpeg($cfg['upload_path'].$image);
    } elseif ($ext == "gif") {
     // Create new image from GIF
  $src = imagecreatefromgif($cfg['upload_path'].$image);
    }
    // Rename new image
 $new_image = substr($image,0,-3).'.gif';
    // Delete old image
    unlink($cfg['upload_path'].$image);
    // Create new JPG image
 imagegif($src,$cfg['upload_path'].$new_image,$cfg['jpg_quality']);
return $new_image;
}

/*
* Stats
*/
function stats() {
 global $db,$cfg;
 // Check global switch
    if ($cfg['stats_order'] == "random") {
     // Run random order query
     $query = $db->query("SELECT * FROM ".$cfg['adverts']." WHERE status = 'P' ORDER BY RAND()");
    } elseif ($cfg['stats_order'] == "hits")  {
     // Run clicks order query
     $query = $db->query("SELECT * FROM ".$cfg['adverts']." WHERE status = 'P' ORDER BY hits DESC");
    }
?>
<!-- BEGIN Statistics -->
<table id=stats>
  <tr >
    <td class="label">URL</td>
    <td class="label">Advert</td>
    <td class="label">Hits</td>
  </tr>
<?php
    while ($result = $db->fetch_array($query)) {
?>
  <tr class="row">
<td class="url"><a href="url.php?id=<?php echo $result['id']; ?>" target="_blank"><?php echo shrstr($result['url'],30); ?></a></td>
    <td class="advert"><img src="<?php echo $cfg['upload_path'].$result['image']; ?>"></td>
    <td class="hits">They've had <strong><?php echo $result['hits']; ?></strong> Visitors</td>
  </tr>
<!-- END Statistics -->
<?php
    }
?>
</table>
<?php
}
/*
* Log errors
*/
function log_error($timestamp,$error) {
 $message = date_format($timestamp,'d-m-y').'-'.$error;
 $file = fopen('error_log.txt', 'a');
 fwrite($file, $message);
 fclose($file);
}
/*
* News
*/
function news() {
 global $db,$cfg;
    $query = $db->query("SELECT * FROM ".$cfg['news']." ORDER BY timestamp DESC");
    while ($result = $db->fetch_array($query)) {
?>
<table id=news>
  <tr>
    <td class="timestamp"><?php echo date_format($result['timestamp'],"d F Y H:i:s"); ?><td>
  </tr>
  <tr>
    <td class="title"><?php echo stripslashes($result['title']); ?><td>
  </tr>
  <tr>
    <td class="text"><?php echo nl2br(stripslashes($result['text'])); ?><td>
  </tr>
  <tr>
    <td class="name">Posted by <?php echo stripslashes($result['name']); ?><td>
  </tr>
</table>
<div class="seperator"></div>
<?php
    }
}
?>
cheers cargi

Last edited by sypher; Jan 6th, 2006 at 20:47.
Reply With Quote
Reply

Tags
having, trouble, scripts, fatal, error, call, undefined, function, imagegif

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Undefined Index error with DB Sphinx111 PHP Forum 3 Apr 21st, 2008 20:37
Call to a non object fatal error alexgeek PHP Forum 2 Feb 21st, 2008 15:34
fatal error alexgeek Webforumz Cafe 3 Aug 27th, 2007 22:16
Fatal error: call to a member function funtion() on a non-object timcallagy Databases 2 Mar 4th, 2007 21:55
Fatal error: Call to a member function getName() on a non-object jono PHP Forum 1 Apr 13th, 2006 18:53


All times are GMT. The time now is 05:45.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43