コード例 #1
0
ファイル: ImageManager.php プロジェクト: vlatosev/filebundle
 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([]);
     }
 }
コード例 #2
0
 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;
 }