Support Forum Project Downloads FAQ Documentation About Demo Tutorials Blog Plugins
November 21, 2009, 05:23:53 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Maintenance release cpg1.4.25 - upgrade recommended
The Coppermine development team is releasing an update for Coppermine in order to fix an issue with http uploads that could occur in particular versions of PHP.The fix is not security-critical, so if your gallery is running fine with cpg1.4.23 or cpg1.4.24 you don't need to upgrade. If you are running an older version than cpg1.4.23, you must update to this latest version as soon as possible because of the security impact (the past few maintenance releases before cpg1.4.24 all were security-related).
[more]
   Home   Help Search Board rules Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: display last uploaded image fullsize in main page  (Read 6398 times)
0 Members and 1 Guest are viewing this topic.
kousik Topic starter
Contributor
***
Gender: Male
Posts: 3



WWW
« on: May 07, 2007, 05: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.
« Last Edit: May 07, 2007, 06:54:21 am by GauGau » Logged
Joachim Müller
Administrator
*****
Gender: Male
Germany Germany

Posts: 45051


aka "GauGau"


WWW
« Reply #1 on: May 07, 2007, 06:53:19 am »

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
Find
Code:
foo
and replace with
Code:
bar
Then find
Code:
bla
and add after it (into a new line)
Code:
whatever
Thanks in advance.

Joachim
Logged
SaWey
Dev Team member
****
Gender: Male
Belgium Belgium

Posts: 1119



WWW
« Reply #2 on: May 07, 2007, 12:57:45 pm »

I took the liberty of creating the code:

In index.php

Find:

Code:
if (!$file) {
                         flush();
                         break;
 
                     case 'lasthits':
                         display_thumbnails('lasthits', $cat, 1, $CONFIG['thumbcols'], max(1, $matches[2]), false);
                         flush();

Change to:

Code:
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:

Code:
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:

Code:
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')
 {
« Last Edit: May 07, 2007, 04:45:08 pm by GauGau » Logged
kousik Topic starter
Contributor
***
Gender: Male
Posts: 3



WWW
« Reply #3 on: May 07, 2007, 02:05:28 pm »

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:
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:

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:

Code:
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
Logged
mentalist3d
Coppermine regular visitor
**
Gender: Male
Posts: 51

http://concepts.org.uk


WWW
« Reply #4 on: November 01, 2007, 10:39:56 am »

Thanks for the mod, it works really well and was something I had been looking for a while. Thanks :-)
Logged
mentalist3d
Coppermine regular visitor
**
Gender: Male
Posts: 51

http://concepts.org.uk


WWW
« Reply #5 on: November 27, 2007, 12:58:07 pm »

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
Logged
bbm
Coppermine novice
*
Posts: 40


« Reply #6 on: July 07, 2009, 12:39:22 pm »

Nice mod ! Would it be possible to have this done with random-pic instead of lastup ?
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.038 seconds with 16 queries.