forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Visuals => Topic started by: kousik on May 07, 2007, 06:59:51 am
-
Hi.
I wanted to display the last uploaded image in full size in the first page. So I wrote up a few lines:
--- index.php~ Mon Apr 30 07:45:15 2007
+++ index.php Mon Apr 30 19:04:23 2007
@@ -822,7 +822,14 @@ if (!$file) {
flush();
break;
+ case 'lastimagefs':
+ $pic_data = get_pic_data('lastup', $thumb_count, $album_name, -1, 1);
+ $pic_url = get_pic_url($pic_data[0], 'fullsize');
+ theme_display_lastimage($pic_url);
+ flush();
+ break;
+
case 'lasthits':
display_thumbnails('lasthits', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
--- include/themes.inc.php~ Mon Apr 30 07:25:17 2007
+++ include/themes.inc.php Mon Apr 30 19:01:18 2007
@@ -1745,6 +1745,16 @@ function theme_display_album_list_cat(&$
}
} //{THEMES}
+if (!function_exists('theme_display_lastimage')) { //{THEMES}
+function theme_display_lastimage($picurl)
+{
+ starttable('100%', "Last uploaded image");
+ echo "<tr><td align=\"center\"><img src=\"$prefix" . "$picurl\" class=\"image\" border=\"0\" alt=\"\"></td></tr>";
+ endtable();
+}
+} //{THEMES}
+
+
if (!function_exists('theme_display_thumbnails')) { //{THEMES}
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
{
So that adding "lastimagefs" as one of the option in "Config > Album List View > Contents of the main page" can display the last image uploaded fullsize.
This is a quick and dirty hack, and I am sure people who are a little bit familiar with coppermine can do a much better job.
regards
Kousik.
-
Thanks for your contribution. However, most users on this board are not capable to read and understand diffs, so I'd ask you to come up with instructions that are normally used on this board, with instructions like this:
Edit foobar.php
Findfoo
and replace withbar
Then findbla
and add after it (into a new line)whatever
Thanks in advance.
Joachim
-
I took the liberty of creating the code:
In index.php
Find:
if (!$file) {
flush();
break;
case 'lasthits':
display_thumbnails('lasthits', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
Change to:
if (!$file) {
flush();
break;
case 'lastimagefs':
$pic_url = get_pic_url($pic_data[0], 'fullsize');
theme_display_lastimage($pic_url);
flush();
break;
case 'lasthits':
display_thumbnails('lasthits', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
In include/themes.inc.php:
Find:
function theme_display_album_list_cat(&$
}
} //{THEMES}
if (!function_exists('theme_display_thumbnails')) { //{THEMES}
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
{
Change to:
function theme_display_album_list_cat(&$
}
} //{THEMES}
if (!function_exists('theme_display_lastimage')) { //{THEMES}
function theme_display_lastimage($picurl)
{
starttable('100%', "Last uploaded image");
echo "<tr><td align=\"center\"><img src=\"$prefix" . "$picurl\" class=\"image\" border=\"0\" alt=\"\"></td></tr>";
endtable();
}
} //{THEMES}
if (!function_exists('theme_display_thumbnails')) { //{THEMES}
function theme_display_thumbnails(&$thumb_list, $nbThumb, $album_name, $aid, $cat, $page, $total_pages, $sort_options, $display_tabs, $mode = 'thumb')
{
-
As per admin suggestion, here goes the modification in more legible format:
In your installation directory, open the file index.php and try locating the following code somewhere under // Main code:
case 'toprated':
display_thumbnails('toprated', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
case 'lastcom':
display_thumbnails('lastcom', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
flush();
break;
Now, in between any two break; and a new case 'something', take 'lastcom' for example, insert the following code:
case 'lastimagefs':
$pic_data = get_pic_data('lastup', $thumb_count, $album_name, -1, 1);
$pic_url = get_pic_url($pic_data[0], 'fullsize');
theme_display_lastimage($pic_url);
flush();
break;
I hope you got the pattern ...
Then open up include/themes.inc.php and add the following code at the bottom:
if (!function_exists('theme_display_lastimage')) { //{THEMES}
function theme_display_lastimage($picurl)
{
starttable('100%', "Last uploaded image");
echo "<tr><td align=\"center\"><img src=\"$prefix" . "$picurl\" class=\"image\" border=\"0\" alt=\"\"></td></tr>";
endtable();
}
} //{THEMES}
Now the groundwork is ready, get to your gallery in admin mode, go to "Config > Album List view". In the box "The content of the main page", there should be some / separated values. Insert lastimagefs wherever you want the last uploaded image to appear in full-size.
An example can be seen in my gallery at http://www.employees.org/~kousik/photography/
Thanks,
Kousik
-
Thanks for the mod, it works really well and was something I had been looking for a while. Thanks :-)
-
Hi, I'm wondering if there is any edits to the script that will allow the last uploaded image to include the details of who uploaded the image (ie - Last uploaded image by USERNAME) with a link back to their profile?
Any help or advice is always welcome :-)
Thanks - James
http://art.concepts.org.uk
-
Nice mod ! Would it be possible to have this done with random-pic instead of lastup ?