getThumbnailDir example



    /** * Returns an array with a jpg and original extension path if its not a jpg * * @param string $suffix * * @return array */
    protected function getDestination(Media $media$suffix)
    {
        $thumbnailDir = $this->getThumbnailDir($media);

        $fileName = str_replace(
            '.' . $media->getExtension(),
            '_' . $suffix . '.jpg',
            $media->getFileName()
        );

        $fileNames = [
            'jpg' => $thumbnailDir . $fileName,
        ];

        
        foreach ($sizes as $size) {
            if (strpos($size, 'x') === false) {
                $size = $size . 'x' . $size;
            }

            $fileName = str_replace(
                '.' . $this->extension,
                '_' . $size . $suffix . '.' . $this->extension,
                $this->getFileName()
            );

            $path = $this->getThumbnailDir() . $fileName;
            $path = str_replace(Shopware()->DocPath(), '', $path);
            if (DIRECTORY_SEPARATOR !== '/') {
                $path = str_replace(DIRECTORY_SEPARATOR, '/', $path);
            }
            $thumbnails[$size] = $path;
        }

        return $thumbnails;
    }

    /** * @return ArrayCollection */
Home | Imprint | This part of the site doesn't use cookies.