Beispiel #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([]);
     }
 }