getThumbnailSizesFromMedia example


    public function createMediaThumbnail(Media $media$thumbnailSizes = []$keepProportions = false)
    {
        $imagePath = $media->getPath();

        if ($media->getType() !== $media::TYPE_IMAGE) {
            throw new Exception(sprintf('File %s is not an image.', $imagePath));
        }

        if (empty($thumbnailSizes)) {
            $thumbnailSizes = $this->getThumbnailSizesFromMedia($media);
            $thumbnailSizes = array_merge($thumbnailSizes$media->getDefaultThumbnails());
        }

        $albumSettings = $this->getAlbumSettingsFromMedia($media);
        if ($albumSettings) {
            $highDpi = $albumSettings->isThumbnailHighDpi();
            $standardQuality = $albumSettings->getThumbnailQuality();
            $highDpiQuality = $albumSettings->getThumbnailHighDpiQuality();
        } else {
            $highDpi = false;
            $standardQuality = 90;
            
Home | Imprint | This part of the site doesn't use cookies.