/** * 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; }
/** * 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); } }
/** * 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()); }
/** * {@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()); }