Beispiel #1
0
 /**
  * Resize this image for use as a thumbnail in a strip. Use in templates with $StripThumbnail.
  * @return GD
  */
 function generateStripThumbnail(GD $gd)
 {
     return $gd->croppedResize($this->stat('strip_thumbnail_width'), $this->stat('strip_thumbnail_height'));
 }
 /**
  * Generate a resized copy of this image with the given width & height, cropping to maintain aspect ratio and focus point.
  * Use in templates with $CropboxImage
  *
  * @param GD $gd
  * @param integer $width Width to crop to
  * @param integer $height Height to crop to
  * @return GD
  */
 public function generateCropboxedImage(GD $gd, $width, $height)
 {
     $width = round($width);
     $height = round($height);
     // Check that a resize is actually necessary.
     if ($width == $this->owner->Width && $height == $this->owner->Height) {
         return $this;
     }
     if ($this->owner->Width > 0 && $this->owner->Height > 0 && $this->owner->CropWidth > 0 && $this->owner->CropHeight > 0) {
         return $gd->crop($this->owner->CropY, $this->owner->CropX, $this->owner->CropWidth, $this->owner->CropHeight)->resize($width, $height);
     } else {
         return $gd->croppedResize($width, $height);
     }
 }