| @@ 263-274 (lines=12) @@ | ||
| 260 | * @param int $guid GUID of the current image |
|
| 261 | * @return TidypicsImage |
|
| 262 | */ |
|
| 263 | public function getPreviousImage($guid) { |
|
| 264 | $imageList = $this->getImageList(); |
|
| 265 | $key = array_search($guid, $imageList); |
|
| 266 | if ($key === FALSE) { |
|
| 267 | return null; |
|
| 268 | } |
|
| 269 | $key--; |
|
| 270 | if ($key < 0) { |
|
| 271 | return get_entity(end($imageList)); |
|
| 272 | } |
|
| 273 | return get_entity($imageList[$key]); |
|
| 274 | } |
|
| 275 | ||
| 276 | /** |
|
| 277 | * Get the next image in the album. Wraps around to the first image if given the last. |
|
| @@ 282-293 (lines=12) @@ | ||
| 279 | * @param int $guid GUID of the current image |
|
| 280 | * @return TidypicsImage |
|
| 281 | */ |
|
| 282 | public function getNextImage($guid) { |
|
| 283 | $imageList = $this->getImageList(); |
|
| 284 | $key = array_search($guid, $imageList); |
|
| 285 | if ($key === FALSE) { |
|
| 286 | return null; |
|
| 287 | } |
|
| 288 | $key++; |
|
| 289 | if ($key >= count($imageList)) { |
|
| 290 | return get_entity($imageList[0]); |
|
| 291 | } |
|
| 292 | return get_entity($imageList[$key]); |
|
| 293 | } |
|
| 294 | ||
| 295 | /** |
|
| 296 | * Get the index into the album for a particular image |
|