Beispiel #1
0
 /**
  * Filter the query by a related \Models\ImageGalleryMap object
  *
  * @param \Models\ImageGalleryMap|ObjectCollection $imageGalleryMap the related object to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return ChildImageQuery The current query, for fluid interface
  */
 public function filterByImageGalleryMap($imageGalleryMap, $comparison = null)
 {
     if ($imageGalleryMap instanceof \Models\ImageGalleryMap) {
         return $this->addUsingAlias(ImageTableMap::COL_ID, $imageGalleryMap->getIdImage(), $comparison);
     } elseif ($imageGalleryMap instanceof ObjectCollection) {
         return $this->useImageGalleryMapQuery()->filterByPrimaryKeys($imageGalleryMap->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByImageGalleryMap() only accepts arguments of type \\Models\\ImageGalleryMap or Collection');
     }
 }
Beispiel #2
0
 /**
  * Remove gallery of this object
  * through the images_galleries_map cross reference table.
  *
  * @param ChildGallery $gallery
  * @return ChildImage The current object (for fluent API support)
  */
 public function removeGallery(ChildGallery $gallery)
 {
     if ($this->getGalleries()->contains($gallery)) {
         $imageGalleryMap = new ChildImageGalleryMap();
         $imageGalleryMap->setGallery($gallery);
         if ($gallery->isImagesLoaded()) {
             //remove the back reference if available
             $gallery->getImages()->removeObject($this);
         }
         $imageGalleryMap->setImage($this);
         $this->removeImageGalleryMap(clone $imageGalleryMap);
         $imageGalleryMap->clear();
         $this->collGalleries->remove($this->collGalleries->search($gallery));
         if (null === $this->galleriesScheduledForDeletion) {
             $this->galleriesScheduledForDeletion = clone $this->collGalleries;
             $this->galleriesScheduledForDeletion->clear();
         }
         $this->galleriesScheduledForDeletion->push($gallery);
     }
     return $this;
 }
Beispiel #3
0
 public function saveEditedGallery($id)
 {
     $gal = GalleryQuery::create()->findPk($id);
     $dir = "includes/images/fullsize/";
     foreach ($_POST["image"] as $post) {
         $d = explode(',', $post);
         $img = imagecreatefromstring(base64_decode($d[1]));
         do {
             $name = token(20) . ".png";
             $path = $dir . $name;
         } while (file_exists($path));
         $i = new Image();
         $i->setPath($name)->setDescription("Fotografie z galerie " . $gal->getName())->setThumbnailPath($name)->setType("fullsize")->save();
         imagepng(resizeImg($img, 1280, 720), $path);
         $dir = "includes/images/960x540/";
         $path = $dir . $name;
         imagepng(resizeImg($img, 960, 540), $path);
         $dir = "includes/images/50x50/";
         $path = $dir . $name;
         imagepng(resizeImg($img, 50, 50), $path);
         $names[] = $name;
     }
     $imgs = ImageQuery::create()->filterByPath($names)->find();
     foreach ($imgs as $i) {
         $map = new ImageGalleryMap();
         $map->setIdImage($i->getId());
         $map->setIdGallery($id);
         $map->save();
     }
     $this->addPopup('success', 'Fotografie byly úspěšné přidány do galerie.');
     redirectTo('/administrace/galerie');
 }