Ejemplo n.º 1
0
 /**
  * create and copy the resized image
  *
  * @param string $sDestinationImage file + path of destination
  * @param string $sSourceImage      file + path of source
  * @param int    $iNewWidth         new width of the image
  * @param int    $iNewHeight        new height of the image
  * @param array  $aImageInfo        additional info
  * @param string $sTarget           target file path
  * @param int    $iGdVer            used gd version
  * @param bool   $blDisableTouch    wether Touch() should be called or not
  *
  * @return null
  */
 protected function _copyAlteredImage($sDestinationImage, $sSourceImage, $iNewWidth, $iNewHeight, $aImageInfo, $sTarget, $iGdVer, $blDisableTouch)
 {
     $blSuccess = copyAlteredImage($sDestinationImage, $sSourceImage, $iNewWidth, $iNewHeight, $aImageInfo, $sTarget, $iGdVer);
     if (!$blDisableTouch && $blSuccess) {
         @touch($sTarget);
     }
     return $blSuccess;
 }
 /**
  * Creates resized JPG image. Returns path of new file if creation
  * succeded. On error returns FALSE
  *
  * @param string   $sSrc              JPG source
  * @param string   $sTarget           new image location
  * @param int      $iWidth            new width
  * @param int      $iHeight           new height
  * @param int      $aImageInfo        original width
  * @param int      $iGdVer            GD library version
  * @param resource $hDestinationImage destination image handle
  * @param int      $iDefQuality       new image quality
  *
  * @return string | false
  */
 function resizeJpeg($sSrc, $sTarget, $iWidth, $iHeight, $aImageInfo, $iGdVer, $hDestinationImage, $iDefQuality)
 {
     $aResult = checkSizeAndCopy($sSrc, $sTarget, $iWidth, $iHeight, $aImageInfo[0], $aImageInfo[1]);
     if (is_array($aResult)) {
         list($iNewWidth, $iNewHeight) = $aResult;
         if ($hDestinationImage === null) {
             $hDestinationImage = $iGdVer == 1 ? imagecreate($iNewWidth, $iNewHeight) : imagecreatetruecolor($iNewWidth, $iNewHeight);
         }
         $hSourceImage = imagecreatefromjpeg($sSrc);
         if (copyAlteredImage($hDestinationImage, $hSourceImage, $iNewWidth, $iNewHeight, $aImageInfo, $sTarget, $iGdVer)) {
             imagejpeg($hDestinationImage, $sTarget, $iDefQuality);
             imagedestroy($hDestinationImage);
             imagedestroy($hSourceImage);
         }
     }
     return makeReadable($sTarget);
 }