示例#1
0
 public function getPhotoForAvatar(OW_Event $e)
 {
     $params = $e->getParams();
     if ($params['entityType'] == 'photo_album') {
         $id = $params['id'];
         $photo = $this->photoService->findPhotoById($id);
         if ($photo) {
             $type = (bool) $photo->hasFullsize ? PHOTO_BOL_PhotoService::TYPE_ORIGINAL : PHOTO_BOL_PhotoService::TYPE_MAIN;
             $data = array('url' => $this->photoService->getPhotoUrlByType($photo->id, $type, $photo->hash, $photo->dimension), 'path' => $this->photoService->getPhotoPath($photo->id, $photo->hash, $type));
             $e->setData($data);
             return $data;
         }
     }
 }
示例#2
0
 public function getAlbumCoverUrl(OW_Event $event)
 {
     $params = $event->getParams();
     $albumId = $params['albumId'];
     $coverDao = PHOTO_BOL_PhotoAlbumCoverDao::getInstance();
     if (($coverDto = $coverDao->findByAlbumId($albumId)) === null) {
         if (($photo = $this->albumService->getLastPhotoByAlbumId($albumId)) === null) {
             $coverUrl = $coverDao->getAlbumCoverDefaultUrl();
         } else {
             $coverUrl = $this->photoService->getPhotoUrlByType($photo->id, PHOTO_BOL_PhotoService::TYPE_MAIN, $photo->hash, !empty($photo->dimension) ? $photo->dimension : false);
         }
         $coverUrlOrig = $coverUrl;
     } else {
         $coverUrl = $coverDao->getAlbumCoverUrlForCoverEntity($coverDto);
         $coverUrlOrig = $coverDao->getAlbumCoverOrigUrlForCoverEntity($coverDto);
     }
     $event->setData(array('coverUrl' => $coverUrl, 'coverUrlOrig' => $coverUrlOrig));
     return $event->getData();
 }