/** * {@inheritDoc} * * @throws \InvalidArgumentException */ public function getVariation(Field $field, VersionInfo $versionInfo, $variationName, array $parameters = array()) { /** @var \eZ\Publish\Core\FieldType\Image\Value $imageValue */ $imageValue = $field->value; $fieldId = $field->id; $fieldDefIdentifier = $field->fieldDefIdentifier; if (!$this->supportsValue($imageValue)) { throw new InvalidArgumentException("Value for field #{$fieldId} ({$fieldDefIdentifier}) cannot be used for image alias generation."); } $originalPath = $imageValue->id; $originalBinary = $this->dataLoader->find($originalPath); // Create the image alias only if it does not already exist. if ($variationName !== IORepositoryResolver::VARIATION_ORIGINAL && !$this->ioResolver->isStored($originalPath, $variationName)) { if ($this->logger) { $this->logger->debug("Generating '{$variationName}' variation on {$originalPath}, field #{$fieldId} ({$fieldDefIdentifier})"); } $this->ioResolver->store($this->applyFilter($originalBinary, $variationName), $originalPath, $variationName); } else { if ($this->logger) { $this->logger->debug("'{$variationName}' variation on {$originalPath} is already generated. Loading from cache."); } } $aliasInfo = new SplFileInfo($this->ioResolver->resolve($originalPath, $variationName)); return new ImageVariation(array('name' => $variationName, 'fileName' => $aliasInfo->getFilename(), 'dirPath' => $aliasInfo->getPath(), 'uri' => $aliasInfo->getPathname(), 'imageId' => $imageValue->imageId)); }
/** * {@inheritDoc} */ public function store(Response $response, $targetPath, $filter) { return $this->resolver->store($response, $targetPath, $filter); }
/** * {@inheritDoc} */ public function store(BinaryInterface $binary, $path, $filter) { $this->resolver->store($binary, $path, $filter); }
/** * {@inheritdoc} */ public function store(BinaryInterface $binary, $targetPath, $filter) { return $this->resolver->store($binary, $targetPath, $filter); }
public function store(BinaryInterface $binary, $path, $filter) { $path = $this->rewritePath($path); $this->resolver->store($binary, $path, $filter); }