コード例 #1
0
ファイル: Croper.php プロジェクト: harpcio/FileUploaderBundle
 /**
  * Get crop resolver configuration
  *
  * @param string $endpoint
  * @return string
  *
  * @throws JbFileUploaderException
  */
 protected function getCropResolver($endpoint)
 {
     $cropedResolver = $this->configuration->getValue($endpoint, 'croped_resolver');
     if (!$cropedResolver) {
         throw new JbFileUploaderException('No croped_resolver configuration for endpoint ' . $endpoint);
     }
     return $cropedResolver;
 }
コード例 #2
0
 /**
  * Validate by applying validators from validator chain
  *
  * @param string $endpoint
  * @param mixed $value
  * @param string $configKey
  *
  * @throws \Jb\Bundle\FileUploaderBundle\Exception\ValidationException
  */
 public function validate($endpoint, $value, $configKey = 'upload_validators')
 {
     $validationConfiguration = $this->configuration->getValue($endpoint, $configKey);
     foreach ((array) $validationConfiguration as $validationType => $config) {
         $validator = $this->validators->getValidator($validationType);
         $validator->applyValidator($value, $config);
     }
 }
コード例 #3
0
 /**
  * Save the transformed file
  *
  * @param string $endpoint
  * @param BinaryInterface $cropedFile
  * @param array $data
  */
 public function saveTransformedFile($endpoint, BinaryInterface $cropedFile, array $data)
 {
     $this->filesystemMap->get($this->configuration->getValue($endpoint, 'croped_fs'))->write($data['filename'], $cropedFile->getContent());
 }
コード例 #4
0
 /**
  * {@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());
 }