/** * 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); }