public function cropImage($sourcePath, $destinationPath, CropImageDOInterface $crop) { if (!$this->filesystem->has($sourcePath)) { throw new NotFoundException('Can not crop. Resource is not found'); } $this->createDirectory(dirname($destinationPath)); $imagick = $this->getImagick($sourcePath); $imagick->cropImage($crop->getWidth(), $crop->getHeight(), $crop->getX(), $crop->getY()); $imagick->writeImage($destinationPath); $imagick->clear(); $imagick->destroy(); }