getSrc() 공개 메소드

Get image src
public getSrc ( string $image, integer $width, integer $height, string $specs = 'fit' ) : string
$image string
$width integer
$height integer
$specs string
리턴 string
예제 #1
0
 /**
  * Get thumbnail
  *
  * @param Newscoop\Image\ImageInterface $image
  * @param Newscoop\Image\ImageService $imageService
  * @return Newscoop\Image\Thumbnail
  */
 public function getThumbnail(ImageInterface $image, ImageService $imageService)
 {
     if (!$this->fits($image)) {
         throw new \InvalidArgumentException("Image is too small.");
     }
     list($width, $height) = NetteImage::calculateSize($image->getWidth(), $image->getHeight(), $this->width, $this->height, $this->getFlags());
     if ($this->isCrop()) {
         $width = min($width, $this->width);
         $height = min($height, $this->height);
     }
     return new Thumbnail($imageService->getSrc($image->getPath(), $this->width, $this->height, $this->getSpecs()), $width, $height);
 }