/** * Generates GIF type image and returns its location on file system * * @param string $sSource image source * @param string $sTarget image target * @param int $iWidth image width * @param int $iHeight image height * * @return string */ protected function _generateGif($sSource, $sTarget, $iWidth, $iHeight) { $aImageInfo = @getimagesize($sSource); return resizeGif($sSource, $sTarget, $iWidth, $iHeight, $aImageInfo[0], $aImageInfo[1], getGdVersion()); }
/** * type dependant image resizing * * @param array $aImageInfo Contains information on image's type / width / height * @param string $sSrc source image * @param string $hDestinationImage Destination Image * @param string $sTarget Resized Image target * @param int $iNewWidth Resized Image's width * @param int $iNewHeight Resized Image's height * @param mixed $iGdVer used GDVersion, if null or false returns false * @param bool $blDisableTouch false if "touch()" should be called for gif resizing * @param string $iDefQuality quality for "imagejpeg" function * * @return bool */ protected function _resize($aImageInfo, $sSrc, $hDestinationImage, $sTarget, $iNewWidth, $iNewHeight, $iGdVer, $blDisableTouch, $iDefQuality) { startProfile("PICTURE_RESIZE"); $blSuccess = false; switch ($aImageInfo[2]) { //Image type case $this->_aImageTypes["GIF"]: //php does not process gifs until 7th July 2004 (see lzh licensing) if (function_exists("imagegif")) { $blSuccess = resizeGif($sSrc, $sTarget, $iNewWidth, $iNewHeight, $aImageInfo[0], $aImageInfo[1], $iGdVer); } break; case $this->_aImageTypes["JPEG"]: case $this->_aImageTypes["JPG"]: $blSuccess = resizeJpeg($sSrc, $sTarget, $iNewWidth, $iNewHeight, $aImageInfo, $iGdVer, $hDestinationImage, $iDefQuality); break; case $this->_aImageTypes["PNG"]: $blSuccess = resizePng($sSrc, $sTarget, $iNewWidth, $iNewHeight, $aImageInfo, $iGdVer, $hDestinationImage); break; } if ($blSuccess && !$blDisableTouch) { @touch($sTarget); } stopProfile("PICTURE_RESIZE"); return $blSuccess; }
/** * Generates GIF type image and returns its location on file system * * @param string $source image source * @param string $target image target * @param int $width image width * @param int $height image height * * @return string */ protected function _generateGif($source, $target, $width, $height) { $imageInfo = @getimagesize($source); return resizeGif($source, $target, $width, $height, $imageInfo[0], $imageInfo[1], $this->validateGdVersion()); }