Пример #1
0
 /**
  * Creates a thumbnail of the current resource. If crop is true, the result will be a perfect
  * fit thumbnail with the given dimensions, cropped by the center. If crop is false, the
  * thumbnail will use the best fit for the dimensions.
  *
  * @param int  $width   Width of the thumbnail.
  * @param int  $height  Height of the thumbnail.
  * @param bool $crop    When set to true, the thumbnail will be cropped from the center to match
  *                      the given size.
  * @param bool $stretch When set to false, an image smaller than the box area won't be scaled up
  *                      to meet the desired size. Defaults to true
  *
  * @return $this
  */
 public function thumbnail($width, $height, $crop = false, $stretch = true)
 {
     if (!$stretch and ($width >= $this->getWidth() and $height >= $this->getHeight())) {
         return $this;
     }
     $this->resource->thumbnail($width, $height, $crop);
     return $this;
 }
Пример #2
0
 /**
  * Creates a thumbnail of the current resource. If crop is true, the result will be a perfect
  * fit thumbnail with the given dimensions, cropped by the center. If crop is false, the
  * thumbnail will use the best fit for the dimensions.
  *
  * @param int  $width  Width of the thumbnail.
  * @param int  $height Height of the thumbnail.
  * @param bool $crop   When set to true, the thumbnail will be cropped from the center to match
  *                     the given size.
  *
  * @return $this
  */
 public function thumbnail($width, $height, $crop = false)
 {
     $this->resource->thumbnail($width, $height, $crop);
     return $this;
 }