isThumbnailHighDpi example

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;
            $highDpiQuality = 90;
        }

        if ($standardQuality === null) {
            $standardQuality = 90;
        }

        
$thumbnailHighDpi = isset($data['thumbnailHighDpi']) && $data['thumbnailHighDpi'];
        $thumbnailQuality = $data['thumbnailQuality'] ?? 90;
        $thumbnailHighDpiQuality = $data['thumbnailHighDpiQuality'] ?? 70;

        $albumId = $album->getId();
        if (empty($albumId) && $data['parent'] !== null) {
            /** @var Settings $parentSettings */
            $parentSettings = $data['parent']->getSettings();

            $thumbnailSizes = $parentSettings->getThumbnailSize();
            $thumbnailHighDpi = $parentSettings->isThumbnailHighDpi();
            $thumbnailHighDpiQuality = $parentSettings->getThumbnailHighDpiQuality();
            $thumbnailQuality = $parentSettings->getThumbnailQuality();
            $createThumbnails = $parentSettings->getCreateThumbnails();
        }

        $settings->setCreateThumbnails($createThumbnails);
        $settings->setThumbnailSize(empty($thumbnailSizes) ? '' : $thumbnailSizes);
        $settings->setThumbnailHighDpi($thumbnailHighDpi);
        $settings->setThumbnailQuality($thumbnailQuality);
        $settings->setThumbnailHighDpiQuality($thumbnailHighDpiQuality);
        $settings->setIcon($icon);

        
// Initial the data array         $imageData = [];
        $mediaService = Shopware()->Container()->get(MediaServiceInterface::class);

        if (empty($image['path'])) {
            return $imageData;
        }

        // First we get all thumbnail sizes of the product album         $sizes = $productAlbum->getSettings()->getThumbnailSize();

        $highDpiThumbnails = $productAlbum->getSettings()->isThumbnailHighDpi();

        // If no extension is configured, shopware use jpg as default extension         if (empty($image['extension'])) {
            $image['extension'] = 'jpg';
        }

        $imageData['src']['original'] = $mediaService->getUrl($image['media']['path']);
        $imageData['res']['original']['width'] = $image['width'];
        $imageData['res']['original']['height'] = $image['height'];
        $imageData['res']['description'] = $image['description'];
        $imageData['position'] = $image['position'];
        
Home | Imprint | This part of the site doesn't use cookies.