예제 #1
1
 /**
  * Generate a resized copy of this image with the given width & height, cropping to maintain aspect ratio.
  * Use in templates with $CroppedImage
  * 
  * @param Image_Backend $backend
  * @param integer $width Width to crop to
  * @param integer $height Height to crop to
  * @return Image_Backend
  */
 public function generateCroppedImage(Image_Backend $backend, $width, $height)
 {
     return $backend->croppedResize($width, $height);
 }
 public function generateMaybeCroppedImage(Image_Backend $backend, $width, $height)
 {
     if ($width > 0 && $height > 0) {
         return $backend->croppedResize($width, $height);
     } elseif ($width > 0) {
         return $backend->resizeByWidth($width);
     } elseif ($height > 0) {
         return $backend->resizeByHeight($height);
     } else {
         return $backend;
     }
 }
예제 #3
0
 /**
  * Generate a resized copy of this image with the given width & height, cropping to maintain aspect ratio.
  * Use in templates with $CroppedImage
  *
  * @param Image_Backend $backend
  * @param integer $width Width to crop to
  * @param integer $height Height to crop to
  * @return Image_Backend
  * @deprecated 4.0 Use generateFill instead
  */
 public function generateCroppedImage(Image_Backend $backend, $width, $height)
 {
     Deprecation::notice('4.0', 'Use generateFill instead');
     return $backend->croppedResize($width, $height);
 }
 public function generateBetterCroppedImage(Image_Backend $backend, $width, $height, $originX, $originY)
 {
     return $backend->croppedResize($width, $height, $originX, $originY);
 }
 /**
  * Resize the image by preserving aspect ratio, keeping the image inside the
  * $width and $height then cropping to the exact $width and $height.
  *
  * @param Image_Backend $backend
  * @param int           $width The width to size to
  * @param int           $height The width to size to
  *
  * @return Image_Backend
  */
 public function generateRatioCrop(Image_Backend $backend, $width, $height)
 {
     $this->owner->generateFormattedImage('SetRatioSize', $width, $height);
     return $backend->croppedResize($width, $height);
 }
예제 #6
0
 /**
  * Generate a resized copy of this image with the given width & height, cropping to maintain aspect ratio.
  * Use in templates with $CroppedImage
  *
  * @param Image_Backend $backend
  * @param integer $width Width to crop to
  * @param integer $height Height to crop to
  * @return Image_Backend
  * @deprecated 4.0 Generate methods are no longer applicable
  */
 public function generateCroppedImage(Image_Backend $backend, $width, $height)
 {
     Deprecation::notice('4.0', 'Generate methods are no longer applicable');
     return $backend->croppedResize($width, $height);
 }