Irin Posted September 2, 2005 Share Posted September 2, 2005 Hello, I have installed an "Automatic Thumbnail" contribution. Almost all of my pictures are GIF and step 5 of the instructions say: 5. Go to the bottom of the catalog/includes/functions/html_output.php and insert before the ?> if your Webspace has GIF read and write ability delete GIF in the following text at $not_supported_formats = array ("GIF"); // Write in capital Letters!! function thumbimage ($image, $x, $y, $aspectratio, $resize, $cachedir){ /*############################################## # - Thumbnail-Script v1.3 - # # Generating thumbnails 'on-the-fly' with PHP # # # # © by Christian Lamine, FlashDreams OHG # # http://www.flashdreams.de/ # # # # Modified by http://www.tse.at # # Modified by [email protected] # # # # This script may be freely used, distributed # # and modified without any charge as long as # # this copyright information is included. # # # # Any commercial selling of this script is # # forbidden. # # # # The author is not responsible for possible # # damage which may result from the application # # of this script, neither direct nor indirect. # # Use at your own risk! # ##############################################*/ error_reporting(0); $types = array (1 => "gif", "jpeg", "png", "swf", "psd", "wbmp"); $not_supported_formats = array ("GIF"); // Write in capital Letters!! umask(0); !is_dir ($cachedir) ? mkdir ($cachedir, 0777) : system ("chmod 0777 ".$cachedir); (!isset ($x) || ereg ('^[0-9]{1,}$', $x, $regs)) && (!isset ($y) || ereg ('^[0-9]{1,}$', $y, $regs)) && (isset ($x) || isset ($y)) ? true : DIE ('Fehlende® oder ung?ltige® Gr??enparameter!'); !isset ($resize) || !ereg ('^[0|1]$', $resize, $regs) ? $resize = 0 : $resize; !isset ($aspectratio) || !ereg ('^[0|1]$', $aspectratio, $regs) ? isset ($x) && isset ($y) ? $aspectratio = 1 : $aspectratio = 0 : $aspectratio; !isset ($image) ? DIE ('Es wurde kein Bild angegeben!') : !file_exists($image) ? DIE ('Die angegebene Datei konnte nicht auf dem Server gefunden werden!') : false; $imagedata = getimagesize($image); !$imagedata[2] || $imagedata[2] == 4 || $imagedata[2] == 5 ? DIE ('Bei der angegebenen Datei handelt es sich nicht um ein Bild!') : false; $imgtype="!(ImageTypes() & IMG_" . strtoupper($types[$imagedata[2]]) . ")"; if ((eval($imgtype)) || (in_array(strtoupper(array_pop(explode('.', basename($image)))),$not_supported_formats))) { $image = substr ($image, (strrpos (DIR_FS_CATALOG . '/', '/'))+1); return $image; } if (!isset ($x)) $x = floor ($y * $imagedata[0] / $imagedata[1]); if (!isset ($y)) $y = floor ($x * $imagedata[1] / $imagedata[0]); if ($aspectratio && isset ($x) && isset ($y)) { if ((($imagedata[1]/$y) > ($imagedata[0]/$x) )){ $x=ceil(($imagedata[0]/$imagedata[1])* $y); } else { $y=ceil($x/($imagedata[0]/$imagedata[1])); } } $thumbfile = '/' . basename($image); if (file_exists ($cachedir.$thumbfile)) { $thumbdata = getimagesize ($cachedir.$thumbfile); $thumbdata[0] == $x && $thumbdata[1] == $y ? $iscached = true : $iscached = false; if (@filemtime($cachedir.$thumbfile) < @filemtime($image)) $iscached = false; } else { $iscached = false; } if (!$iscached) { ($imagedata[0] > $x || $imagedata[1] > $y) || (($imagedata[0] < $x || $imagedata[1] < $y) && $resize) ? $makethumb = true : $makethumb = false; } else { $makethumb = false; } if ($makethumb) { $image = call_user_func("imagecreatefrom".$types[$imagedata[2]], $image); if (function_exists("imagecreatetruecolor") && ($thumb = imagecreatetruecolor ($x, $y))) { imagecopyresampled ($thumb, $image, 0, 0, 0, 0, $x, $y, $imagedata[0], $imagedata[1]); } else { $thumb = imagecreate ($x, $y); imagecopyresized ($thumb, $image, 0, 0, 0, 0, $x, $y, $imagedata[0], $imagedata[1]); } call_user_func("image".$types[$imagedata[2]], $thumb, $cachedir.$thumbfile); imagedestroy ($image); imagedestroy ($thumb); $image = DIR_WS_IMAGES . 'imagecache' . $thumbfile; } else { $iscached ? $image = DIR_WS_IMAGES . 'imagecache' . $thumbfile : $image = substr ($image, (strrpos (DIR_FS_CATALOG . '/', '/'))+1); } return $image; } When I delete GIF in $not_supported_formats = array (""); // Write in capital Letters!! per instructions, I have all of my pictures shown on a black background instead of transparent. How can I change their background? Thanks in advance, Irina. Quote Link to comment Share on other sites More sharing options...
Jodoi Posted June 12, 2006 Share Posted June 12, 2006 I have exactly the same problem as above...is it possible to fix this? Quote Link to comment Share on other sites More sharing options...
1_musketeer Posted February 1, 2007 Share Posted February 1, 2007 I am having the same problem with transparent backgrounds being changed to black backgrounds by automatic thumbnail V1.7 It works perfectly if there is already a background in the image. Has anyone found a solution to this? Any help would be much appreciated as this is a great contribution which is really needed. 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.