Thought I'd get a couple of questions out of the way at the same time so here goes;
Firstly I'm using the following to call a random image onto a page outside of zenphoto:
`
<?php
$randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "<a href='".$randomImageURL."' title='Featured Image'>
getFullImage() . "'alt=\"random image\"\n" . $randomImage->getTitle() . '" width="290" />
Click the image to go to the image page
';
?>
`
Which is working great but, as you can see, I've entered a width=290 bit to control the width. Is there a way of adding something that allows me to control the image's parameters better i.e. cropped width and height so I can fit it into a predefined slot on my static page? Adding both a width and height (as above) results in a squished image if the original exceeds the ratio of the prescribed w/h. I suspect it's the 'getFullImage' part that's got to change but I've tried getCustomImageURL and a couple of others (adding the required options and dimensions in brackets that follow) to no avail...what am I missing?
The second part of my question involves a slightly different problem I'm trying to get around;
I want a page to display the most recent additions to the gallery, say 6. I have created a static page, latestimages.php (as this appears to be the solution discussed around here on numerous occasions) and styled to look like a normal album page.
A normal album page uses the following to display thumbnails:
`
`
The latest images page uses the 'printLatestImages' function as follows - though this does lose the lightbox function I've got on normal album pages (the rel="album" bit):
`
<?php printLatestImages(6,'', true,false, false, 0, '',$ls?null:210,$ls?null:127,true,false); ?>
`
Unfortunately this puts all 6 thumbnails within one large box, the div class 'imagethumb', initially intended for just one thumbnail at a time in the usual album pages. It appears the function is creating a 'Latest' div which the thumbnails sit in, I've tried to style for that too but it ends up the same; all thumbnails in one big box rather than each in their own individual ones as the 'Latest' div is a wrap-around rather than per thumbnail. Any ideas?
If there's a way to adapt the original (normal) album page code to allow for a lightbox that would be great too. One possible solution I thought of whilst writing this would be to create a customised search for the latest images but I've no idea where to start on how to get that to work...
any help very gratefully received!
Comments
2. `printLatestImages creates this setup:
`
`
So you already got an element for each image to style. Zenphoto by default comes with Colorbox and you can attach that to any element via jQuery you like. No explicit "rel" needed.
Of course the images lead to the image page not to the full image for a *box script. Of course you can make your own custom function. Because of that we have also a `getImageStatistic` function that just gets the data (we have for most "print" function such a "get" function.)
To follow my curiosity I scanned the image_album_statistics file and I notice it's possible to edit line 418 from:
`
echo "getImageLink())."\" title=\"" . html_encode($image->getTitle()) . "\">\n";
`
to add the required 'rel=' for the lightbox thing I have running.
`
echo "getImageLink())."\" title=\"" . html_encode($image->getTitle()) . "\">\n";
`
Is it possible to swap `htmlspecialchars($image->getImageLink())` for something in order to work properly? I've tried `getFullImageURL()` among other functions in the docs but it doesn't seem to like it. It may not be possible but just thought I'd try on the off chance...
p.s. Is it possible to perform a search for the latest images somehow? Thinking that might be one very easy way around things by creating a dynamic album from the result as outlined in the user guide.
You have to use `$image->getFullImage()` instead (all in the doc of the image class).
Regarding search, you could search by date but the date is not necessarily the "latest" as the discovery order is actually by id and you can't search on that field.
I suppose the search could be done with a more hands-on approach by tagging new images with a particular term and then removing it when new stuff comes in and so on...bit of a faff but by no means out of the question.
Thanks for your help again