Guest Dale Massey Posted September 3, 2005 Share Posted September 3, 2005 Hi, Im having trouble with editing products at thegamescompany.co.uk "Fatal error: Call to undefined function: imagecreatefromjpeg() in /home/dalegame/public_html/classes/gd.inc.php on line 47" And the file "<?php /* +-------------------------------------------------------------------------- | CubeCart v3.0.0 | ======================================== | by Alistair Brookbanks | CubeCart is a Trade Mark of Devellion Limited | © 2005 Devellion Limited | Devellion Limited, | Westfield Lodge, | Westland Green, | Little Hadham, | Nr Ware, HERTS. | SG11 2AL | UNITED KINGDOM | http://www.devellion.com | UK Private Limited Company No. 5323904 | ======================================== | Web: http://www.cubecart.com | Date: Friday, 1 July 2005 | Email: [email protected] | License Type: CubeCart is NOT Open Source Software and Limitations Apply | Licence Info: http://www.cubecart.com/site/faq/license.php +-------------------------------------------------------------------------- | gd.inc.php | ======================================== | GD Class +-------------------------------------------------------------------------- */ class thumbnail { var $img; function thumbnail($imgfile) { //detect image format $this->img["format"]=ereg_replace(".*\.(.*)$","\\1",$imgfile); $this->img["format"]=strtoupper($this->img["format"]); if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG $this->img["format"]="JPEG"; $this->img["src"] = ImageCreateFromJPEG ($imgfile); } elseif ($this->img["format"]=="PNG") { //PNG $this->img["format"]="PNG"; $this->img["src"] = ImageCreateFromPNG ($imgfile); } elseif ($this->img["format"]=="GIF") { //GIF $this->img["format"]="GIF"; $this->img["src"] = ImageCreateFromGIF ($imgfile); } else { //DEFAULT echo "Not Supported File! Thumbnails can only be made from .jpg and .jpeg file types!"; exit(); } @$this->img["width"] = imagesx($this->img["src"]); @$this->img["height"] = imagesy($this->img["src"]); //default quality jpeg $this->img["quality"]=80; } function size_width($size=100) { //width $this->img["width_thumb"]=$size; @$this->img["height_thumb"] = ($this->img["width_thumb"]/$this->img["width"])*$this->img["height"]; } function size_auto($size=100) { //size if ($this->img["width"]>=$this->img["height"]) { $this->img["width_thumb"]=$size; @$this->img["height_thumb"] = ($this->img["width_thumb"]/$this->img["width"])*$this->img["height"]; } else { $this->img["height_thumb"]=$size; @$this->img["width_thumb"] = ($this->img["height_thumb"]/$this->img["height"])*$this->img["width"]; } } function jpeg_quality($quality=80) { //jpeg quality $this->img["quality"]=$quality; } function show() { global $config; @Header("Content-Type: image/".$this->img["format"]); if ($config['gdversion']==2) { $this->img["des"] = imagecreatetruecolor($this->img["width_thumb"],$this->img["height_thumb"]); @imagecopyresampled ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["width_thumb"],$this->img["height_thumb"], $this->img["width"], $this->img["height"]); } elseif ($config['gdversion']==1) { $this->img["des"] = imagecreate($this->img["width_thumb"],$this->img["height_thumb"]); @imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["width_thumb"],$this->img["height_thumb"], $this->img["width"], $this->img["height"]); } if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG imageJPEG($this->img["des"],"",$this->img["quality"]); } elseif ($this->img["format"]=="PNG") { //PNG imagePNG($this->img["des"]); } elseif ($this->img["format"]=="GIF") { //GIF imageGIF($this->img["des"]); } imagedestroy($this->img["des"]); } function save($save="") { global $config; if ($config['gdversion']==2) { $this->img["des"] = imagecreatetruecolor($this->img["width_thumb"],$this->img["height_thumb"]); @imagecopyresampled ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["width_thumb"], $this->img["height_thumb"], $this->img["width"], $this->img["height"]); } elseif ($config['gdversion']==1) { $this->img["des"] = imagecreate($this->img["width_thumb"],$this->img["height_thumb"]); @imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["width_thumb"], $this->img["height_thumb"], $this->img["width"], $this->img["height"]); } if ($this->img["format"]=="JPG" || $this->img["format"]=="JPEG") { //JPEG imageJPEG($this->img["des"],$save,$this->img["quality"]); } elseif ($this->img["format"]=="PNG") { //PNG imagePNG($this->img["des"],$save); } elseif ($this->img["format"]=="GIF") { //GIF imageGIF($this->img["des"],$save); } imagedestroy($this->img["des"]); @chmod($this->img["des"], 0644); } } ?>" Thanks, Dale Quote Link to comment Share on other sites More sharing options...
roban Posted September 3, 2005 Share Posted September 3, 2005 For those who are as bad at counting lines as I am, this is line 47 $this->img["format"]="JPEG"; So, what is the extension of the image you are trying to upload? Quote Link to comment Share on other sites More sharing options...
Guest jeromas Posted September 3, 2005 Share Posted September 3, 2005 Hmm fatal call to a function that is part of the PHP GD library makes me think your webserver/webhost doesn't have the PHP GD libraries installed. Capitalization doesn't matter in PHP functions unlike variables, since function names are converted to lowercase before PHP stores them. If you want to find out for sure, make a web page with the code below, and navigate to it: <?php phpinfo(); ?> Look through all the information listed about your version of PHP, and you should see something similar to the following: gd GD Support enabled GD Version bundled (2.0.28 compatible) FreeType Support enabled FreeType Linkage with freetype GIF Read Support enabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Support enabled XBM Support enabled If GD support is not enabled, you'll probably need to take care of that with your webhost or IT person. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.