Jump to content

[Minor] makethumb.txt(gif support)


Guest billmc
 Share

Recommended Posts

Guest billmc

File Name :: makethumb.txt(gif support)

Author :: billmc

Category :: Minor

Description

This is the moded makethumb.txt that enables *.gif support for image upload. It assumes that gd2 is available which has *.gif support. Copyright issues for *.gif are discussed elsewhere. Upload to your cubecart2 /images folder

View File

Link to comment
Share on other sites

this mod didnt work for me. I uploaded it to my cubecart images folder and still couldnt upload gif images, i also checked the GD version and it was 2.0 something

Link to comment
Share on other sites

Theres a reason for that.

Although this little mod tells makethumb.txt to make thumbs of gifs, there are unfortunately, other error checking codes in place, that prevent gifs from being uploaded.

These also need to be amended.

In add_product.php, line 414, nee4ds to be changed from

if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg")) {

to


if (($userfile_type=="image/x-png") || ($userfile_type=="image/pjpeg") || ($userfile_type=="image/jpeg") || ($userfile_type=="image/gif")) {

Also, you will need to make the exact same change to edit_product.php, line 169.

Categories are not affected as categories allow gifs, as category images are not thumbnailed.

Link to comment
Share on other sites

  • 3 weeks later...

Tried all these steps but gif thumbs still not being created any ideas???

I used the new makethumb.txt from the forum altered the format checks as above but no joy.

This is the error

Warning: imagecreatefromgif(/home/***;)********/public_html/images/Watch_FlashSticker.gif): failed to open stream: No such file or directory in /home/sites/*********/public_html/images/makethumb.txt on line 44

Warning: imagecreatetruecolor(): Invalid image dimensions in /home/***:lol:********/public_html/images/makethumb.txt on line 107

Warning: imagegif(): supplied argument is not a valid Image resource in /home/***:lol:********/public_html/images/makethumb.txt on line 123

Below is the make thumb txt for reference

Gary

<?

/***************************************************************************

*   Copyright:       Copyright 2003 http://www.brooky.com

*       

***************************************************************************/

// CONFIGURATION FOR THUMBNAILS

// FOR GD VERSION 1.6 (default) SET $gd_version=1;

// FOR GD VERSION 2.0+ FOR IMPROVED THUMBNAILS SET $gd_version=2;

// IF YOU DO NOT HAVE GD SET $gd_version=0;

$gd_version=2;

// HOW CAN I TELL WHAT VERSION I RUN?

// Login to admin and click server environment off the main menu.

// If you have GD you will see a table entitled GD and the

// version number will be displayed there. :))

// END THUMBNAILS CONFIG

// *************************************************************************

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  .png and >gif images!";

  exit();

}

@$this->img["lebar"] = imagesx($this->img["src"]);

@$this->img["tinggi"] = imagesy($this->img["src"]);

//default quality jpeg

$this->img["quality"]=75;

}

function size_auto($size=100)

{

//size

if ($this->img["lebar"]>=$this->img["tinggi"]) {

     $this->img["lebar_thumb"]=$size;

     @$this->img["tinggi_thumb"] = ($this->img["lebar_thumb"]/$this->img["lebar"])*$this->img["tinggi"];

} else {

     $this->img["tinggi_thumb"]=$size;

     @$this->img["lebar_thumb"] = ($this->img["tinggi_thumb"]/$this->img["tinggi"])*$this->img["lebar"];

  }

}

function jpeg_quality($quality=75)

{

//jpeg quality

$this->img["quality"]=$quality;

}

function show($gd_version)

{

@Header("Content-Type: image/".$this->img["format"]);

  if($gd_version==2)

               {

               $this->img["des"] = imagecreatetruecolor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);

         @imagecopyresampled ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"],$this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);

         }

               if($gd_version==1)

               {

               $this->img["des"] = imagecreate($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);

         @imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"],$this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);

         }

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"]);

  }

}

function save($save="",$gd_version)

{

if($gd_version==2)

               {

               $this->img["des"] = imagecreatetruecolor($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);

         @imagecopyresampled ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"], $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);

         }

               if($gd_version==1)

               {

              $this->img["des"] = imagecreate($this->img["lebar_thumb"],$this->img["tinggi_thumb"]);

        @imagecopyresized ($this->img["des"], $this->img["src"], 0, 0, 0, 0, $this->img["lebar_thumb"],      $this->img["tinggi_thumb"], $this->img["lebar"], $this->img["tinggi"]);

         }

  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");

}

}

}

// *************************************************************************

?>

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...

Not only are they not being created...I am still getting the "Not supported file type. Thumbs can only be made from.jpg and .png files."

Actually, .jpg, .png, and .gif file types, but i didn;t include the .gif as, obviously, its still not an allowed file type.

Even worse, I don't even HAVE and gif product images.

I do have some gif graphical elements...but I'm not asking Cube to thumbnail them.

Link to comment
Share on other sites

  • 3 months later...
 Share

×
×
  • Create New...