diff -ur /home/tobias/tmp/typo3/typo3_src-3.7.0/t3lib/class.t3lib_basicfilefunc.php typo3_src-3.7.0/t3lib/class.t3lib_basicfilefunc.php --- /home/tobias/tmp/typo3/typo3_src-3.7.0/t3lib/class.t3lib_basicfilefunc.php 2004-09-24 13:06:11.000000000 +0200 +++ typo3_src-3.7.0/t3lib/class.t3lib_basicfilefunc.php 2005-03-02 03:06:46.000000000 +0100 @@ -147,7 +147,6 @@ * @return array Information about the file in the filepath */ function getTotalFileInfo($wholePath) { - $theuser = getmyuid(); $info = t3lib_div::split_fileref($wholePath); $info['tstamp'] = @filectime($wholePath); $info['size'] = @filesize($wholePath); diff -ur /home/tobias/tmp/typo3/typo3_src-3.7.0/t3lib/class.t3lib_stdgraphic.php typo3_src-3.7.0/t3lib/class.t3lib_stdgraphic.php --- /home/tobias/tmp/typo3/typo3_src-3.7.0/t3lib/class.t3lib_stdgraphic.php 2004-09-24 13:06:11.000000000 +0200 +++ typo3_src-3.7.0/t3lib/class.t3lib_stdgraphic.php 2005-02-28 02:09:56.000000000 +0100 @@ -1989,6 +1989,51 @@ * Scaling, Dimensions of images * ***********************************/ + /* + * Scaling using PHP functions + */ + function resizepics($pics, $output, $newwidth, $newheight){ + list($width, $height, $ext) = @getimagesize($pics); + if($width >= $height && $newheight < $height){ + $newheight = $height / ($width / $newwidth); + } else if ($width <= $height && $newwidth < $width) { + $newwidth = $width / ($height / $newheight); + } else { + $newwidth = $width; + $newheight = $height; + } + switch($ext) { + case 1: + $source = imagecreatefromgif($pics); + break; + case 2: + $source = imagecreatefromjpeg($pics); + break; + case 3: + $source = imagecreatefrompng($pics); + break; + default: + break; + } + $thumb = @imagecreatetruecolor($newwidth, $newheight); + // @imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); + @imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); + if(preg_match("/.jpg/i", "$output")){ + return imagejpeg($thumb, $output); + } + if(preg_match("/.jpeg/i", "$output")){ + return imagejpeg($thumb, $output); + } + if(preg_match("/.jpeg/i", "$output")){ + return imagejpeg($thumb, $output); + } + if(preg_match("/.png/i", "$output")){ + return imagepng($thumb, $output); + } + if(preg_match("/.gif/i", "$output")){ + return imagegif($thumb, $output); + } + } /** * Converts $imagefile to another file in temp-dir of type $newExt (extension). @@ -2005,11 +2050,12 @@ * @see getImageScale(), typo3/show_item.php, fileList_ext::renderImage(), tslib_cObj::getImgResource(), SC_tslib_showpic::show(), maskImageOntoImage(), copyImageOntoImage(), scale() */ function imageMagickConvert($imagefile,$newExt='',$w='',$h='',$params='',$frame='',$options='',$mustCreate=0) { + /* if ($this->NO_IMAGE_MAGICK) { // Returning file info right away return $this->getImageDimensions($imagefile); } - + */ if($info=$this->getImageDimensions($imagefile)) { $newExt=strtolower(trim($newExt)); if (!$newExt) { // If no extension is given the original extension is used @@ -2068,6 +2114,9 @@ $GLOBALS['TEMP_IMAGES_ON_PAGE'][] = $output; if (!$this->file_exists_typo3temp_file($output,$imagefile) || $this->dontCheckForExistingTempFile) { + if ($this->NO_IMAGE_MAGICK) + $this->resizepics($imagefile, $output, $info[0], $info[1]); + else $this->imageMagickExec($imagefile.$frame,$output,$command); } if (@file_exists($output)) { diff -ur /home/tobias/tmp/typo3/typo3_src-3.7.0/t3lib/thumbs.php typo3_src-3.7.0/t3lib/thumbs.php --- /home/tobias/tmp/typo3/typo3_src-3.7.0/t3lib/thumbs.php 2004-09-24 13:06:11.000000000 +0200 +++ typo3_src-3.7.0/t3lib/thumbs.php 2005-02-28 03:24:54.000000000 +0100 @@ -156,6 +156,48 @@ } } + function resizepics($pics, $output, $newwidth, $newheight){ + list($width, $height, $ext) = @getimagesize($pics); + if($width > $height && $newheight < $height){ + $newheight = $height / ($width / $newwidth); + } else if ($width < $height && $newwidth < $width) { + $newwidth = $width / ($height / $newheight); + } else { + $newwidth = $width; + $newheight = $height; + } + switch($ext) { + case 1: + $source = imagecreatefromgif($pics); + break; + case 2: + $source = imagecreatefromjpeg($pics); + break; + case 3: + $source = imagecreatefrompng($pics); + break; + default: + break; + } + $thumb = @imagecreatetruecolor($newwidth, $newheight); + @imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); + if(preg_match("/.jpg/i", "$output")){ + return imagejpeg($thumb, $output); + } + if(preg_match("/.jpeg/i", "$output")){ + return imagejpeg($thumb, $output); + } + if(preg_match("/.jpeg/i", "$output")){ + return imagejpeg($thumb, $output); + } + if(preg_match("/.png/i", "$output")){ + return imagepng($thumb, $output); + } + if(preg_match("/.gif/i", "$output")){ + return imagegif($thumb, $output); + } + } + /** * Create the thumbnail * Will exit before return if all is well. @@ -233,7 +275,35 @@ } else { $this->errorGif('Read problem!','',$this->output); } - } else exit; + } else //exit; + { + // If thumbnail does not exist, we generate it + if (!@file_exists($this->output)) { +/* if (strstr($this->input,' ') || strstr($this->output,' ')) { + $this->errorGif('Spaces in','filepath',$this->input); + } +*/ // 16 colors for small (56) thumbs, 64 for bigger and all for jpegs + if ($outext=='jpg') { + $colors = ''; + } else { + $colors = ($sizeMax>56)?'-colors 64':'-colors 16'; + } + $this->resizepics($this->input, $this->output, $this->sizeParts[0], $this->sizeParts[1]); + if (!@file_exists($this->output)) { + $this->errorGif('No thumb','generated!',$this->input); + } + } + // The thumbnail is read and output to the browser + if($fd = @fopen($this->output,'rb')) { + Header('Content-type: image/'.$outext); + while (!feof($fd)) { + echo fread( $fd, 10000 ); + } + fclose( $fd ); + } else { + $this->errorGif('Read problem!','',$this->output); + } + } } else { $this->errorGif('No valid','inputfile!',$this->input); }