display last uploaded image fullsize in main page display last uploaded image fullsize in main page
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

display last uploaded image fullsize in main page

Started by kousik, May 07, 2007, 06:59:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kousik

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.

Joachim Müller

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:
Quote
Edit foobar.php
Findfooand replace withbarThen findblaand add after it (into a new line)whatever
Thanks in advance.

Joachim

SaWey

#2
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')
{

kousik

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

mentalist3d

Thanks for the mod, it works really well and was something I had been looking for a while. Thanks :-)

mentalist3d

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

bbm

Nice mod ! Would it be possible to have this done with random-pic instead of lastup ?