createThumbnail example

'Shopware_Components_Thumbnail_Manager_CreateThumbnail',
                $parameters,
                ['subject' => $this, 'media' => $media]
            );
        }

        foreach ($parameters['sizes'] as $size) {
            $suffix = $size['width'] . 'x' . $size['height'];

            $destinations = $this->getDestination($media$suffix);
            foreach ($destinations as $destination) {
                $this->generator->createThumbnail(
                    $parameters['path'],
                    $destination,
                    $size['width'],
                    $size['height'],
                    $parameters['keepProportions'],
                    $standardQuality
                );
            }
        }

        if (!$highDpi) {
            
$media = new Media();
        $media->setId($data['id']);
        $media->setExtension($data['extension']);
        $media->setName($data['name']);
        $media->setPreview($data['preview']);
        $media->setType($data['type']);
        $media->setFile($data['file']);
        $media->setDescription($data['description']);

        $me = $this;
        $thumbnails = array_map(function D$thumbnailData) use ($me) {
            return $me->createThumbnail($thumbnailData);
        }$data['thumbnails']);

        $media->setThumbnails($thumbnails);
        $media->addAttributes($this->createAttributes($data['attributes']));

        return $media;
    }

    /** * @param array $data * * @return Thumbnail */
// To avoid any confusing, we're mapping the index based to an association based array and remove the index based elements.             $data['width'] = $data[0];
            $data['height'] = $data[1];
            unset($data[0]$data[1]);

            // Continue if configured size is not numeric             if (!is_numeric($data['width'])) {
                continue;
            }

            // Create thumbnail with the configured size             $this->createThumbnail((int) $data['width'](int) $data['height']);
        }
    }

    /** * Removes the configured album thumbnails for the passed album instance and with the * passed file name. The file name have to be passed, because on update the internal * file name property is already changed to the new name. * * @param array|null $thumbnailSizes * @param string $fileName */
    
Home | Imprint | This part of the site doesn't use cookies.