Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: display last uploaded image fullsize in main page  (Read 15057 times)

0 Members and 1 Guest are viewing this topic.

kousik

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3
    • Kousik & Sumana's Photography
display last uploaded image fullsize in main page
« 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.
« Last Edit: May 07, 2007, 07:54:21 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: display last uploaded image fullsize in main page
« Reply #1 on: May 07, 2007, 07: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: [Select]
fooand replace with
Code: [Select]
barThen find
Code: [Select]
blaand add after it (into a new line)
Code: [Select]
whatever
Thanks in advance.

Joachim
Logged

SaWey

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1119
    • SaWey.be
Re: display last uploaded image fullsize in main page
« Reply #2 on: May 07, 2007, 01:57:45 pm »

I took the liberty of creating the code:

In index.php

Find:

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

Change to:

Code: [Select]
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: [Select]
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: [Select]
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, 05:45:08 pm by GauGau »
Logged

kousik

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3
    • Kousik & Sumana's Photography
Re: display last uploaded image fullsize in main page
« Reply #3 on: May 07, 2007, 03: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: [Select]
                    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: [Select]
                    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: [Select]
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
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
  • http://concepts.org.uk
    • Concept Art
Re: display last uploaded image fullsize in main page
« Reply #4 on: November 01, 2007, 11: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
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 51
  • http://concepts.org.uk
    • Concept Art
Re: display last uploaded image fullsize in main page
« Reply #5 on: November 27, 2007, 01: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
  • *
  • Offline Offline
  • Posts: 42
Re: display last uploaded image fullsize in main page
« Reply #6 on: July 07, 2009, 01:39:22 pm »

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

Page created in 0.021 seconds with 19 queries.