/** * Copy image to temporary directory * * @param FilterDataEvent $event * @return void */ public function postSetData(DataEvent $event) { $entity = $event->getData(); if ($entity instanceof ImageInterface && null !== $entity->getId()) { $this->imageManager->copyImagesToTemporaryDirectory($entity); } }
/** * Copy images from permenent to temporary directory * * @param DataEvent $event */ public function postSetData(DataEvent $event) { $collection = $event->getData(); if ($collection instanceof Collection) { foreach ($collection as $image) { if ($image instanceof MultiImageInterface && null !== $image->getId()) { $this->imageManager->copyImagesToTemporaryDirectory($image); } } } }
/** * Checks if images is modified by some other user * * @param ImageInterface $entity * @param string $hash * @throws ImageHashException */ protected function checksum(ImageInterface $entity, $hash) { $currentHash = $this->imageManager->getImageInfo($entity)->getTemporaryImageHash(); if ($hash !== $currentHash) { throw new ImageHashException($entity->getName()); } }