0) { if ($number == 0 || $number > $photo_count) { $number = $photo_count; } if ($random) { $random_full_urls = array(); $random_photos = array(); $rand_keys = array_rand ($urls, $number); if ($number == 1) { $rand_keys = array($rand_keys); } foreach ($rand_keys as $key) { $random_urls[] = $urls[$key]; $random_full_urls[] = $full_urls[$key]; $random_captions[] = $captions[$key]; } $urls = $random_urls; $full_urls = $random_full_urls; $captions = $random_captions; } if (empty($albumName)) { if ($random) { $title = sprintf(_("%s Random Images from %s"), $number, $gallery->app->galleryTitle); } else { $title = sprintf(_("Slide Show for Gallery :: %s"), $gallery->app->galleryTitle); } } else { if ($random) { $title = sprintf(_("%d Random Images from album :: %s"), $number, $gallery->album->fields["title"]); } else { $title = sprintf(_("Slide Show for album :: %s"), $gallery->album->fields["title"]); } } } } function buildSlideshowPhotos(&$full_urls, &$urls, &$captions, $album = null, $recursive = true) { global $gallery, $full_option; $photo_count = 0; if (!$album) { // Top level $albumDB = new AlbumDB(false); $numAlbums = $albumDB->numAlbums($gallery->user); for ($i = 1; $i <= $numAlbums; $i++) { $subAlbum = $albumDB->getAlbum($gallery->user, $i); if (!$gallery->user->canReadAlbum($subAlbum)) { continue; } $photo_count += buildSlideshowPhotos($full_urls, $urls, $captions, $subAlbum, $recursive); } return $photo_count; } if (!$gallery->user->canReadAlbum($album)) { return $photo_count; } $numPhotos = $album->numPhotos(1); $numDisplayed = 0; // Find the correct starting point, accounting for hidden photos $index = getNextPhoto(0, $album); $photo_count = 0; while ($numDisplayed < $numPhotos) { if ($index > $numPhotos) { /* * We went past the end -- this can happen if the last element is * an album that we can't read. */ break; } $photo = $album->getPhoto($index); $numDisplayed++; // Skip movies if ($photo->isMovie()) { $index = getNextPhoto($index, $album); continue; } if ($photo->isAlbum()) { if ($recursive) { $subAlbumName = $album->getAlbumName($index); $subAlbum = new Album(); $subAlbum->load($subAlbumName); if ($gallery->user->canReadAlbum($subAlbum)) { $photo_count += buildSlideshowPhotos($full_urls, $urls, $captions, $subAlbum, $recursive); } } $index = getNextPhoto($index, $album); continue; } $photo_count++; $urls[] = $album->getPhotoPath($index, 0); if ($gallery->user->canViewFullImages($album)) { $full_option = true; $full_urls[] = $album->getPhotoPath($index, 1); } else { $full_urls[] = $album->getPhotoPath($index, 0); } $caption = $album->getCaption($index); if ($recursive) { $caption .= ' (' . $album->fields['title'] . ')'; } $caption .= $album->getCaptionName($index); $caption = str_replace("\"", " ", $caption); $caption = str_replace("\n", " ", $caption); $caption = str_replace("\r", " ", $caption); // Print out the entry for this image as Javascript $captions[] = $caption; // Go to the next photo $index = getNextPhoto($index, $album); } return $photo_count; } function printSlideshowPhotos($full_urls, $urls, $captions, $what, $photo_count) { $count = 0; for ($index = 0; $index < $photo_count; $index++) { $count++; if (($what &PHOTO_URL) != 0) { print "photo_urls[$count] = \"" . $urls[$index] . "\";\n"; } if (($what &PHOTO_URL_AS_HREF) != 0) { print "\n"; print "\n"; } if (($what &PHOTO_CAPTION) != 0) { // Print out the entry for this image as Javascript print "photo_captions[$count] = \"" . $captions[$index] . "\";\n"; } } } function slideshow_body() { global $gallery, $albumName, $defaultLoop, $defaultPause, $defaultTransition, $full_option, $album, $recursive, $number, $random, $loop, $borderColor, $borderwidth, $bgcolor, $url, $full_urls, $urls, $caption, $captions, $photo_count, $title, $transitionNames, $transitionCount, $pixelImage; global $playIconText, $stopIconText, $normalSizeIconText, $fullSizeIconText, $forwardIconText, $backwardIconText; $photo_count = $number; /* Here are the URLs of the images written down as links. ** This is to make wget able to convert these links. ** It will not convert them, if they are written inside JavaScript. ** JavaScript will then take the images out of these links with "document.getElementById()". */ printSlideshowPhotos($full_urls, $urls, $captions, PHOTO_URL_AS_HREF, $photo_count); ?> ?>
0) { ?>