Example #1
0
 public function updateImage(EdImage $image, EntityManagerInterface $em)
 {
     $source = $image->getFile()->getUploadFile();
     if ($source instanceof File) {
         $imagine = $this->imgproc->getImagine();
         $file = $imagine->open($source->getPathname());
         $island = $this->imgproc->isLandscapeOrient($file);
         if ($island) {
             $image->setWidth($file->getSize()->getWidth());
             $image->setHeight($file->getSize()->getHeight());
         } else {
             $image->setHeight($file->getSize()->getWidth());
             $image->setWidth($file->getSize()->getHeight());
         }
         $image->setProcessed(true);
         $image->setHashString($this->getUniqueCachedName($em));
         $image->setArea([]);
     }
 }
 private function isRegistered(EdImage $image, $type)
 {
     return $this->em->createQuery("SELECT COUNT(ir) FROM EDVFileBundle:EdImageRegister AS ir JOIN ir.image AS im WHERE im.id = :imgid AND ir.type = :type")->setParameters(['imgid' => $image->getId(), 'type' => $type])->getSingleScalarResult() > 0;
 }