Beispiel #1
0
 public function ajaxCropPhoto(array $params = array())
 {
     if (!OW::getRequest()->isAjax()) {
         exit;
     }
     $form = new PHOTO_CLASS_MakeAlbumCover();
     if ($form->isValid($_POST)) {
         if (($album = $this->photoAlbumService->findAlbumById($form->getElement('albumId')->getValue())) === NULL) {
             exit(json_encode(array('result' => FALSE)));
         }
         if (($urls = $this->photoAlbumService->cropAlbumCover($album, $_POST['coords'], $_POST['view_size'], !empty($_POST['photoId']) ? $_POST['photoId'] : 0)) !== FALSE) {
             exit(json_encode(array('result' => TRUE, 'url' => $urls['cover'], 'urlOrig' => $urls['coverOrig'])));
         }
         exit(json_encode(array('result' => FALSE)));
     } else {
         exit(json_encode(array('result' => FALSE)));
     }
 }