Esempio n. 1
0
 /**
  * Declares an association between this object and a ChildImage object.
  *
  * @param  ChildImage $v
  * @return $this|\Models\User The current object (for fluent API support)
  * @throws PropelException
  */
 public function setImage(ChildImage $v = null)
 {
     if ($v === null) {
         $this->setIdImage(NULL);
     } else {
         $this->setIdImage($v->getId());
     }
     $this->aImage = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the ChildImage object, it will not be re-added.
     if ($v !== null) {
         $v->addUser($this);
     }
     return $this;
 }
Esempio n. 2
0
 /**
  * Exclude object from result
  *
  * @param   ChildImage $image Object to remove from the list of results
  *
  * @return $this|ChildImageQuery The current query, for fluid interface
  */
 public function prune($image = null)
 {
     if ($image) {
         $this->addUsingAlias(ImageTableMap::COL_ID, $image->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Esempio n. 3
0
 /**
  * Filter the query by a related \Models\Image object
  *
  * @param \Models\Image|ObjectCollection $image The related object(s) to use as filter
  * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @throws \Propel\Runtime\Exception\PropelException
  *
  * @return ChildUserQuery The current query, for fluid interface
  */
 public function filterByImage($image, $comparison = null)
 {
     if ($image instanceof \Models\Image) {
         return $this->addUsingAlias(UserTableMap::COL_ID_IMAGE, $image->getId(), $comparison);
     } elseif ($image instanceof ObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(UserTableMap::COL_ID_IMAGE, $image->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByImage() only accepts arguments of type \\Models\\Image or Collection');
     }
 }
Esempio n. 4
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');
 }