示例#1
0
 /**
  * Crop an image
  *
  * @param string $endpoint
  * @param array $data
  *
  * @return string
  */
 public function crop($endpoint, array $data)
 {
     // Throw ValidationException if there is an error
     $this->validator->validate($endpoint, $data, 'crop_validators');
     // Generate croped image
     $cropedFile = $this->cropManager->transformFile($data);
     // Save it to filesystem using gaufrette
     $this->cropManager->saveTransformedFile($endpoint, $cropedFile, $data);
     // Return data
     return array('filepath' => $this->resolvers->getResolver($this->getCropResolver($endpoint))->getUrl($data['filename']), 'filename' => $data['filename']);
 }
 /**
  * {@inheritDoc}
  */
 public function getUrl(FileHistory $fileHistory, $resolverType = 'upload_resolver')
 {
     // Add file path to response
     $resolver = $this->resolvers->getResolver($this->configuration->getValue($fileHistory->getType(), $resolverType));
     return $resolver->getUrl($fileHistory->getFilename());
 }