/**
  * Removes all caches for a specific image. This is usually called
  * when a new version of an image is uploaded.
  * 
  * Automatically calls "flush" on the entity manager.
  * 
  * @param Image $image The image to invalidate
  */
 public static function invalidate(Image $image)
 {
     $qb = PartKeepr::getEM()->createQueryBuilder();
     $qb->select(array("c"))->from('PartKeepr\\Image\\CachedImage', 'c')->where("c.originalId = :id")->andWhere("c.originalType = :type")->setParameter("id", $image->getId())->setParameter("type", $image->getType());
     $query = $qb->getQuery();
     $bImagesRemoved = false;
     foreach ($query->getResult() as $file) {
         unlink($file->getCacheFile());
         PartKeepr::getEM()->remove($file);
         $bImagesRemoved = true;
     }
     if ($bImagesRemoved) {
         PartKeepr::getEM()->flush();
     }
 }
 /**
  * Creates a new IC logo instance
  */
 public function __construct()
 {
     parent::__construct(Image::IMAGE_ICLOGO);
 }
 /**
  * Creates a new IC logo instance
  */
 public function __construct()
 {
     parent::__construct(Image::IMAGE_FOOTPRINT);
 }
Exemple #4
0
 public function __construct()
 {
     parent::__construct(Image::IMAGE_TEMP);
 }
 /**
  * Creates a new storage location image instance
  */
 public function __construct()
 {
     parent::__construct(Image::IMAGE_STORAGELOCATION);
 }