forum.coppermine-gallery.net
Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: TNPihl on May 26, 2011, 09:16:14 pm
-
On the front page I have thumbnail of the last uploaded photo and I want a link to the same photo. But when I add the URL below it doesn't link to the last uploaded photo, but the second last.
/displayimage.php?album=lastup&cat=0&pos=1
What do I have to change so it will be the last photo.
Thanks.
-
Try pos=0
-
I have tried that, but it gives this error:
The selected album/file does not exist!
-
Please post a link to your gallery and any code that shows us how you display that thumbnail on your front page.
-
The Gallery:
http://www.jimcarreyonline.com/images/
The Website with Latest Photo (thumbnail below Latest News)
http://www.jimcarreyonline.com/
Code:
<a href="/images/displayimage.php?album=lastup&cat=0&pos=0"><img src="<? echo $img ?>" alt="Latest Photo - Check out our image gallery" style="margin-top: 11px; opacity: 0.6; filter:alpha(opacity=60); -moz-opacity: 0.6; border: 1px solid #12522B;"></a>
(The thumbnail is working. It is the latest photo, but the URL to the page won't work)
-
Please also post the code that generates $img. It should be easy to extend that code so it fetches the picture id, which you need to build the correct link
displayimage.php?album=lastup&cat=0&pid=<picture_id>
-
<?
function get_latest_image() {
$query = 'select filepath, filename from cpg133_pictures where approved = "YES" order by pid desc limit 1';
list($img, $sql) = sql_query($query, 'jco', 1,1);
return ('/images/albums/'.$img['filepath'].'thumb_'.$img['filename']);
}
?>
-
Changing your function to
<?
function get_latest_image() {
$query = 'select filepath, filename, pid from cpg133_pictures where approved = "YES" order by pid desc limit 1';
list($img, $sql) = sql_query($query, 'jco', 1,1);
return array('/images/albums/'.$img['filepath'].'thumb_'.$img['filename'], $img['pid']);
}
?>
should give you all needed data.
-
I tried to paste it. It was not working.
-
Of course it won't work as-is, as I changed the return value. You have to adjust the rest of your code (which I don't know) accordingly. If I have to ask for every piece of code it isn't easy for me to help you, so again, please post the whole code if you need further assistance.
-
$img = get_latest_image();
?>
<div style="float: right; width: 140px; height: 116px; background: url(/img/dot_bar_v.gif) repeat-y; text-align: center;">
<img src="/img/hp/latest_photo.gif" width=80 height=5 alt="Latest Photo"><br>
<a href="/images/displayimage.php?album=lastup&cat=0&pos=0"><img src="<? echo $img ?>" alt="Latest Photo - Check out our image gallery" style="margin-top: 11px; opacity: 0.6; filter:alpha(opacity=60); -moz-opacity: 0.6; border: 1px solid #12522B;"></a>
</div>
</div>
<div style="clear: both;"></div>
<?
function get_latest_image() {
$query = 'select filepath, filename from cpg133_pictures where approved = "YES" order by pid desc limit 1';
list($img, $sql) = sql_query($query, 'jco', 1,1);
return ('/images/albums/'.$img['filepath'].'thumb_'.$img['filename']);
}
?>
-
Try to change
<a href="/images/displayimage.php?album=lastup&cat=0&pos=0"><img src="<? echo $img ?>"
to
<a href="/images/displayimage.php?album=lastup&cat=0&pid=<? echo $img[1] ?>"><img src="<? echo $img[0] ?>"
-
It isn't working. It gives the same error. The thumbail is also not working. :-\
-
Can't you just use cpmfetch to display the image, and provide the link. Set lastup, and one column, one row will give a single image which will be clickable.
Just an idea. ;)