getMediaThumbnails example

$parts = explode('x', $size);

            return [
                'width' => $parts[0],
                'height' => $parts[1],
            ];
        }$sizes);

        if (isset($sizes[$imageSize])) {
            $type = $this->getTypeOfImage($hash);

            $thumbnails = $thumbnailManager->getMediaThumbnails($fileName$type$extension[$sizes[$imageSize]]);

            if (empty($thumbnails)) {
                return '';
            }

            return $this->fixShopHost(
                $mediaService->getUrl($thumbnails[0]['source']),
                $mediaService->getAdapterType()
            );
        }

        
if (isset($data['__media_width'])) {
            $media->setWidth((int) $data['__media_width']);
        }

        if (isset($data['__media_height'])) {
            $media->setHeight((int) $data['__media_height']);
        }

        if ($this->shouldAddThumbnails($media->getType()$data)) {
            $media->setThumbnails(
                $this->getMediaThumbnails($data)
            );
        }

        if (!empty($data['__mediaAttribute_id'])) {
            $this->attributeHydrator->addAttribute($media$data, 'mediaAttribute', 'media');
        }

        return $media;
    }

    /** * @return Media */
->where('article.id = :articleId')
                ->andWhere('images.parentId IS NULL')
                ->orderBy('images.position')
                ->setParameter('articleId', $articleId);

        $result = $builder->getQuery()->getArrayResult();

        foreach ($result as &$item) {
            if (empty($item['media'])) {
                continue;
            }
            $thumbnails = $thumbnailManager->getMediaThumbnails(
                $item['media']['name'],
                $item['media']['type'],
                $item['media']['extension'],
                [
                    [
                        'width' => 140,
                        'height' => 140,
                    ],
                ]
            );

            
Home | Imprint | This part of the site doesn't use cookies.