private function inCollection($photo, $hash) { $parent = $this->photo_model->getStackParent($photo); $photo = $parent ? $parent : $photo; // check existing in collection $collection = new photosCollection($hash); $current_offset = $collection->getPhotoOffset($photo); $collection_photos = $collection->getPhotos("id", $current_offset, 1, false); return isset($collection_photos[$photo['id']]); }
private function getPhoto($url) { $photo = $this->photo_model->getByField('url', $url); if (!$photo) { $this->private_hash = photosPhotoModel::parsePrivateUrl($url); $photo = $this->photo_model->getByField('hash', $this->private_hash); $parent = $this->photo_model->getStackParent($photo); $this->hash = photosPhotoModel::getPrivateHash($parent ? $parent : $photo); } return $photo; }
public function getPhotoStream(photosCollection $collection) { $parent = $this->photo_model->getStackParent($this->photo); $current_photo = $parent ? $parent : $this->photo; $offset = $collection->getPhotoOffset($current_photo); $total_count = $collection->count(); $count = $this->getConfig()->getOption('photos_per_page'); $offset = max($offset - floor($count / 2), 0); $photos = array_values($collection->getPhotos('*,thumb,thumb_crop,thumb_middle,thumb_big,tags,edit_rights', $offset, $count)); return array('photos' => $photos, 'current_photo_id' => $current_photo['id']); }