Project

General

Profile

Bug #14537 » 2005-05_19_bugfix_760-gifbuilder1.patch

Administrator Admin, 2005-05-19 23:53

View differences:

t3lib/class.t3lib_stdgraphic.php 19 May 2005 21:53:30 -0000
'jpg' => '',
'jpeg' => '',
'gif' => '-colors 64',
'png' => '-colors 64'
'png' => '-colors 65536'
);
var $NO_IMAGE_MAGICK = '';
var $V5_EFFECTS = 0;
......
$theMask2 = $tmpStr.'_mask2.'.trim($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_mask_temp_ext_noloss']);
// prepare overlay image
$cpImg = $this->imageCreateFromFile($BBimage[3]);
$destImg = imagecreate($w,$h);
$destImg = $this->imagecreate($w,$h);
ImageColorAllocate($destImg, 0,0,0);
$this->copyGifOntoGif($destImg,$cpImg,$conf,$workArea);
$this->ImageGif($destImg, $theImage);
......
imageDestroy($destImg);
// prepare mask image
$cpImg = $this->imageCreateFromFile($BBmask[3]);
$destImg = imagecreate($w,$h);
$destImg = $this->imagecreate($w,$h);
ImageColorAllocate($destImg, 0,0,0);
$this->copyGifOntoGif($destImg,$cpImg,$conf,$workArea);
$this->ImageGif($destImg, $theMask);
......
imagecopyresized($im_base, $im, 0,0,0,0, imagesx($im),imagesy($im),imagesx($im),imagesy($im)); // Copy the source image onto that
imagecopyresized($im_base, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h); // Then copy the $cpImg onto that (the actual operation!)
$im = $im_base; // Set pointer
$this->makeEffect($im, Array('value'=>'colors=256')); // Reduce colors to 256 - make SURE that IM is working then!
$this->makeEffect($im, Array('value'=>'colors=65536')); // Reduce colors to 256 - make SURE that IM is working then!
} else {
imagecopyresized($im, $cpImg, $Xstart, $Ystart, $cpImgCutX, $cpImgCutY, $w, $h, $w, $h);
}
......
// NiceText is calculated
if (!$conf['niceText']) {
// Font Color is reserved:
$this->reduceColors($im,256, 200);
if (!$this->GD2 || !$conf['format'] || $conf['format']=='gif') {
$this->reduceColors($im,256, 200);
}
$Fcolor = ImageColorAllocate($im, $cols[0],$cols[1],$cols[2]);
// antiAliasing is setup:
$Fcolor = ($conf['antiAlias']) ? $Fcolor : -$Fcolor;
......
$newH = ceil($sF*imagesy($im));
// Make mask
$maskImg = imagecreate($newW, $newH);
$maskImg = $this->imagecreate($newW, $newH);
ImageColorAllocate($maskImg, 255,255,255);
$Fcolor = ImageColorAllocate($maskImg, 0,0,0);
if ($spacing || $wordSpacing) { // If any kind of spacing applys, we use this function:
......
$this->imageMagickExec($fileMask,$fileMask,$command);
// Make the color-file
$colorImg = imagecreate($w,$h);
$colorImg = $this->imagecreate($w,$h);
ImageColorAllocate($colorImg, $cols[0],$cols[1],$cols[2]);
$this->ImageGif($colorImg, $fileColor);
ImageDestroy($colorImg);
......
$fileMask = $tmpStr.'_mask.'.$this->gifExtension;
// BlurColor Image laves
$blurColImg = imagecreate($w,$h);
$blurColImg = $this->imagecreate($w,$h);
$bcols=$this->convertColor($conf['color']);
ImageColorAllocate($blurColImg, $bcols[0],$bcols[1],$bcols[2]);
$this->ImageGif($blurColImg, $fileColor);
ImageDestroy($blurColImg);
// The mask is made: BlurTextImage
$blurTextImg = imagecreate($w+$blurBorder*2,$h+$blurBorder*2);
$blurTextImg = $this->imagecreate($w+$blurBorder*2,$h+$blurBorder*2);
ImageColorAllocate($blurTextImg, 0,0,0); // black background
$txtConf['fontColor'] = 'white';
$blurBordArr = Array($blurBorder,$blurBorder);
......
if ($blurTextImg_tmp) { // if nothing went wrong we continue with the blurred mask
// cropping the border from the mask
$blurTextImg = imagecreate($w,$h);
$blurTextImg = $this->imagecreate($w,$h);
$this->imagecopyresized($blurTextImg, $blurTextImg_tmp, 0, 0, $blurBorder, $blurBorder, $w, $h, $w, $h);
ImageDestroy($blurTextImg_tmp); // Destroy the temporary mask
......
$conf['offset']=$cords[0].','.$cords[1];
$cords = $this->objPosition($conf,$workArea,Array($cords[2],$cords[3]));
$cols=$this->convertColor($conf['color']);
$this->reduceColors($im,256, 255);
if (!$this->GD2 || !$conf['format'] || $conf['format']=='gif') {
$this->reduceColors($im,256, 255);
}
$tmpColor = ImageColorAllocate($im, $cols[0],$cols[1],$cols[2]);
imagefilledrectangle($im, $cords[0], $cords[1], $cords[0]+$cords[2]-1, $cords[1]+$cords[3]-1, $tmpColor);
}
......
$commands.=' -flop';
break;
case 'colors':
$commands.=' -colors '.t3lib_div::intInRange($value,2,255);
$commands.=' -colors '.t3lib_div::intInRange($value,2,65535);
break;
case 'shear':
$commands.=' -shear '.t3lib_div::intInRange($value,-90,90);
......
$conf['offset']=$cords[0].','.$cords[1];
$cords = $this->objPosition($conf,$this->workArea,Array($cords[2],$cords[3]));
$newIm = imagecreate($cords[2],$cords[3]);
$newIm = $this->imagecreate($cords[2],$cords[3]);
$cols=$this->convertColor($conf['backColor']?$conf['backColor']:$this->setup['backColor']);
ImageColorAllocate($newIm, $cols[0],$cols[1],$cols[2]);
......
}
/**
* switch between imagecreatetruecolor und imagecreate based on GD version
*
* @param integer X dimensions
* @param integer Y dimensions
* @return resource newly created mage resource
*/
function imagecreate($x, $y) {
if($this->GD2) {
return imagecreatetruecolor($x, $y);
} else {
return imagecreate($x, $y);
}
}
......
if ($this->ImageGif($this->im, $file)) {
// ImageMagick operations
if($this->setup['reduceColors']) {
$this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,255));
if ($ext == 'gif')
$this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,255));
else
$this->imageMagickExec($file,$file,' -colors '.t3lib_div::intInRange($this->setup['reduceColors'],2,65535));
t3lib_div::gif_compress($file,''); // Compress with IM (lzw) or GD (rle) (Workaround for the absence of lzw-compression in GD)
} else {
t3lib_div::gif_compress($file, 'IM'); // Compress with IM! (adds extra compression, LZW from ImageMagick) (Workaround for the absence of lzw-compression in GD)
......
// If non of the above:
$i = @getimagesize($sourceImg);
$im = imagecreate($i[0],$i[1]);
$im = $this->imagecreate($i[0],$i[1]);
ImageColorAllocate($im, 128,128,128);
return $im;
}
tslib/class.tslib_gifbuilder.php 19 May 2005 21:53:32 -0000
$XY = $this->XY;
// Gif-start
$this->im = imagecreate($XY[0],$XY[1]);
$this->im = $this->imagecreate($XY[0],$XY[1]);
$this->w = $XY[0];
$this->h = $XY[1];
(8-8/10)