| 1 | <?php |
||
| 18 | class PasteFilterLoader implements LoaderInterface |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var ImagineInterface |
||
| 22 | */ |
||
| 23 | protected $imagine; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $projectDir; |
||
| 29 | |||
| 30 | public function __construct(ImagineInterface $imagine, $projectDir) |
||
| 31 | { |
||
| 32 | $this->imagine = $imagine; |
||
| 33 | $this->projectDir = $projectDir; |
||
| 34 | } |
||
| 35 | |||
| 36 | /** |
||
| 37 | * @see \Liip\ImagineBundle\Imagine\Filter\Loader\LoaderInterface::load() |
||
| 38 | * |
||
| 39 | * @param ImageInterface $image |
||
| 40 | * @param array $options |
||
| 41 | * |
||
| 42 | * @return ImageInterface|static |
||
| 43 | */ |
||
| 44 | public function load(ImageInterface $image, array $options = []) |
||
| 45 | { |
||
| 46 | $x = isset($options['start'][0]) ? $options['start'][0] : null; |
||
| 47 | $y = isset($options['start'][1]) ? $options['start'][1] : null; |
||
| 48 | |||
| 49 | $file = $this->projectDir . '/' . $options['image']; |
||
| 50 | |||
| 51 | if (!file_exists($file) { |
||
| 52 | @trigger_error( |
||
| 53 | 'The ' . $file . ' does not exists, change the path based on kernel.project_dir parameter', |
||
| 54 | E_USER_DEPRECATED |
||
| 64 |