Esempio n. 1
0
 private function _saveGalleryPhoto(RM_Photo $photo)
 {
     /* @var RM_Gallery $gallery */
     $gallery = RM_Gallery::getById($this->_getParam('id'));
     $gallery->addPhoto($photo);
     $gallery->savePhotos();
     $w = isset($_REQUEST['w']) ? (int) $_REQUEST['w'] : 0;
     $h = isset($_REQUEST['h']) ? (int) $_REQUEST['h'] : 0;
     $w = $w === 0 ? $photo->getWidth() : $w;
     $h = $h === 0 ? $photo->getHeight() : $h;
     echo json_encode(array('id' => $photo->getIdPhoto(), 'path' => $photo->getPath((int) $w, (int) $h), 'w' => $w, 'h' => $h));
 }
Esempio n. 2
0
 public function getGallery()
 {
     if (!$this->_gallery instanceof RM_Gallery) {
         $this->_gallery = RM_Gallery::getById($this->getIdGallery());
     }
     return $this->_gallery;
 }