I may be going about this completely wrong, but I'm trying to make a
"one photo a day" photoblog out of gallery2. I like this plan better
than using, say wordpress. Anyway, I've made a simplified version of
the Siriux theme to display nothing but the photo. I retained the
"click on the right" navigation, and made a little button to bring
up all the usual picture info, comments, etc.
What I'm missing is a permanent URL that always brings up the latest
added photo. I'd like "next" and all the other features to still work
too. Perhaps the only way to do this is a tiny page that redirects to
the right URL. That'd be okay too, but I'm still new with G2 and I
think it would take me weeks to figure it out by myself. Any help?
--Thanks in advance, Paul
Posts: 27300
Without seeing your photoblog it is hard to see what you are after. But I would use the image block module and use the recent image parameter. Somthing like this in the template file:
{g->block type="imageblock.ImageBlock" blocks="recentImage" maxSize=50}
You could change the maxSize and make sure that you have the defaults in the imageblock admin page set or add the other parameters you need.Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 6
Thanks a bunch for the reply Dave. I guess I didn't do a good job of describing what I need, I'll try again. I don't think seeing my not-quite-ready site will really help.
When someone comes to my site, whatever.com, I want to show them the first photo in my "daily" album. I want this page to have some info and navigation, but it will be hidden until they click on the right thing or hover over the right spot.
In order to do this, I've modified a theme so that the photo page displays a single photo and hides all the nav and info until they click on a button. I have this page working acceptably.
The problem I'm trying to solve is that when they come to my site, they see the list of albums. What I want, is for them to be automatically redirected to the photo page of the first photo in my "daily" album. If there's a magical URL parameter that means "show the first image" then I can easily setup a redirect to take them to that URL. If there is no magical URL parameter, then what I think I need is a tiny PHP page that figures out what the right URL is and redirects them to that page.
So, what would a tiny standalone PHP file look like to do that? Here's my stab at pseudo-code that I think I need:
include_once "a bunch of gallery files";
$album = $g->get_album_by_name("daily");
$image = $album->get_first_image();
$url = $image->get_url();
header("Location: $url");
If I can get someone to help me turn that into actual gallery code, that'd be wonderful.
--Paul
Posts: 4342
I'll have a go at sorting this out in the next few days, as I need something similar myself.
Posts: 4342
This script (call it latest.php, and put it in the same folder as gallery's main.php) will redirect to the last uploaded picture in an album (you need to know the album id):
Put the albumId in the variable in line 4.
Note: this will only work if the browser has permissions to view the original uploaded image - it won't show derivatives, or originals with watermarks.
If instead of the image (only) you wand the gallery page for that picture, change DownloadItem to ShowItem (line 23).
Posts: 6
Thanks!! You are the man! alecmyers++
--Paul
Posts: 3
wow, great! Thx a lot
Would it be also possible to display the *thumbnail* of the latest picture?
Posts: 4342
For thumbnails instead, nsert these four lines:
before the line