Project

General

Profile

Feature #14781 ยป class.t3lib_stdgraphic.diff.txt

Administrator Admin, 2005-05-31 21:48

 
--- o\class.t3lib_stdgraphic.php 2005-05-23 02:41:10.000000000 +0200
+++ c\class.t3lib_stdgraphic.php 2005-05-30 17:38:58.000000000 +0200
@@ -2007,8 +2007,35 @@
*/
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);
+ /* by bednee */
+ if ($info = $this->getImageDimensions($imagefile)) {
+ $data = $this->getImageScale($info,$w,$h,$options);
+ $w=$data['0'];
+ $h=$data['1'];
+ $ext = $info[2];
+ $path = $info[3];
+ $filename = strrchr($path,'/');
+ $filename = ereg_replace('^/','',$filename);
+ $filename = strtolower($filename);
+ $new_path = $this->absPrefix.$this->tempPath.'pics/'.ereg_replace('\.(.+)$',$w.'x'.$h.'.\\1',$filename);
+ if (!file_exists($new_path)) {
+ if (($ext=='jpg')||($ext=='png')) {
+ $newIm = ImageCreateTrueColor($w,$h);
+ if ($ext == 'jpg') { $im = ImageCreateFromJPEG($path); }
+ else { $im = ImageCreateFromPNG($path); }
+ imagecopyresampled($newIm,$im,0,0,0,0,$w,$h,$info[0],$info[1]);
+
+ $this->createTempSubDir('pics/');
+
+ if ($ext == 'jpg') { imagejpeg($newIm,$new_path); }
+ else { imagepng($newIm,$new_path); }
+
+ }
+ }
+ }
+ $x = Array($w,$h,$ext,$new_path);
+ return $x;
+ /* by bednee */
}
if($info=$this->getImageDimensions($imagefile)) {
    (1-1/1)