![]() |
|
Code to access first image of a sub-gallery - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Code to access first image of a sub-gallery (/thread-2097.html) |
Code to access first image of a sub-gallery - codedface - 2008-01-17 I'm using the 'example' theme and I'm trying to figure out how to get the first image of an album. Well what I'm REALLy trying to do is to skip the second level album page and just jump right in to the image view. Confused? Me too Code to access first image of a sub-gallery - codedface - 2008-01-17 A little more context to my request above: in template-functions.php (in 'example' theme) there is a method 'getAlbumLinkURL' I would like to have a check so it appends the first image to the url if it is a sub album. if (is a sub album){ Code to access first image of a sub-gallery - sbillard - 2008-01-17 Do you want the thumbnails of the images or the actual first image? I am not clear on what you are trying to do. Are you going to inhibit the thumbnails of the subalbum? Or do you want to skip the image thumbnails pages? You can create a custom function to do this and replace the two getAlbumLinkURL() calls with it: `function getFirstImageLinkURL() { global $_zp_current_album, $_zp_current_image; $images = $_zp_current_album->getImages(); // array of images in sort order $_zp_current_image = $images[0]; // first image return getImageLinkURL(); }` Code to access first image of a sub-gallery - codedface - 2008-01-17 sorry for not being clear. this is almost what I need (i know i'm close). Code to access first image of a sub-gallery - codedface - 2008-01-17 sbillard - THANKS! I got it. all I did was modify the return line to append the image. seem the array was returning a string an not an object. return getAlbumLinkURL(). "&image=" . $_zp_current_image; I removed the subalbum in the breadcrumb and I'm good to go. |