Good afternoon,
My issues is fairly simple. I have a few PHP pages outside of gallery I'd like to include some recent thumbnails on. Is there a PHP snippet someone could share to simply grab the last x image thumbnails (linked to the image) added to a gallery2 setup?
Thanks, much appreciated! I've been searching for a solution with no luck.
Posts: 32509
you can use the external imageblock or GalleryEmbed::getImageBlock an call it with blocks=recentImage|recentImage|recentImage|recentImage|recentImage to get the 5 latest thumbnails.
see:
http://codex.gallery2.org/index.php/Gallery2:How_Tos#Image_Block
Posts: 14
Thanks valiant for pointing that out. Looks like this is what I was after.
Posts: 14
Ok, I've got it working great. How can I edit the manner in which the images are displayed? Right now each image is wrapped in a div. I want to simplify the html which is used to display the recent images and set them up to display horizontal instead of vertical. How could I do this? Thanks!
Posts: 14
Ok, I've got it all worked out. Here is the php I used:
I was then able to edit the .tpl file called ImageBlocks.tpl under modules > imageblocks > templates and strip out the div tags. Added a class to the link tag and some custom CSS. Viola, nicely formatted horizontal recent images.
This of course only worked because I am not using any image blocks in my gallery2 setup. I am assuming my template edits apply to any image blocks in gallery2 .. right?
Posts: 32509
yep, there are no separate templates for external imageblocks / getImageBlock imageblocks. you could change g2 to work like that. but right now there's a single template for all kinds of imageblocks.
Posts: 6
I'm a little confused.. I tried adding this to my wordpress but whenever I add the code I get the path added after the wordpress path, not replaced.
so..im getting the bold before the path
require_once(dirname(__FILE__) . '/gallery/embed.php');
$ret = GalleryEmbed::init(array('fullInit' => true, 'embedPath' => '/gallery/'));
What do I do?