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: Gallery Thumbnail Ascending Title Number  (Read 10843 times)

0 Members and 1 Guest are viewing this topic.

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Gallery Thumbnail Ascending Title Number
« on: January 11, 2010, 09:46:33 pm »

Hi, How do I add a dynamically generated title-number under each thumbnail?  For example http://www.mydreambakery.biz/gallery/thumbnails.php?album=13  How do I have an ascending number title from top left to bottom right?  Also, is there a way to batch file name change, and or batch file title? 

Do I need a plugin to make this work? 

Thanks!   
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Gallery Thumbnail Ascending Title Number
« Reply #1 on: January 12, 2010, 08:06:13 am »

How do I add a dynamically generated title-number under each thumbnail?
Each image inside coppermine's database already has got a unique ID that you could use. You'll need to edit your theme accordingly. Zip your custom theme folder and attach it to your posting.

Also, is there a way to batch file name change, and or batch file title? 
We have a strict "one question per thread" policy that you agreed to respect when signing up.
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #2 on: January 12, 2010, 11:35:28 am »

Thanks for your help and I'll be sure not to ever ask 2 questions in one threat ;)

I've attached my theme.  If you can guide me to make the dynamic numbering happen I will be greatful.

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Gallery Thumbnail Ascending Title Number
« Reply #3 on: January 12, 2010, 05:17:26 pm »

I have edited your custom theme accordingly. Apply the new theme that I have attached instead of your existing one. Edit your stylesheet to change the way the uid looks.
I edited your HTML markup in template.html as well, as there were a lot of mistakes in that files. Looks like you're using an editor that is not suitable for editing plain text files.
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #4 on: January 12, 2010, 06:00:01 pm »

WoW! You rock man!  Thanks so much for your time :)

I uploaded the new edited theme, and here's what I get: http://www.mydreambakery.biz/gallery/thumbnails.php?album=8

is there a way for each album to have ascending numbering rather than the entire gallery be number as is right now? 

For example, if one clicks on the "Bridal Cakes / Showers" the thumbnails would start from "1" to "x"
and the same for the rest of the albums? 

Thanks again for your time!
Logged

Nibbler

  • Guest
Re: Gallery Thumbnail Ascending Title Number
« Reply #5 on: January 12, 2010, 06:09:14 pm »

What do you want to happen when the sorting is changed?
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #6 on: January 12, 2010, 06:13:27 pm »

I would like each section or album to have titles under each thumbnail, and have it increment numerically.  So that when you click on an album the numbering begins with one to "x".  Is this at all possible?  We're almost there.. and it looks good too.  Thanks!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Gallery Thumbnail Ascending Title Number
« Reply #7 on: January 12, 2010, 06:29:13 pm »

Edit themes/winterdreams/theme.php, find
Code: [Select]
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}$uid_link",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
    '{UNIQUE_ID}' => $thumb['pid'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
and replace with
Code: [Select]
                $params = array('{CELL_WIDTH}' => $cell_width,
                    '{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}$uid_link",
                    '{THUMB}' => $thumb['image'],
                    '{CAPTION}' => $thumb['caption'],
    '{UNIQUE_ID}' => $thumb['pos'],
                    '{ADMIN_MENU}' => $thumb['admin_menu']
                    );
I can't see the point in that though: after having applied those changes, go to http://www.mydreambakery.biz/gallery/thumbnails.php?album=8&page=1&sort=ta, then to http://www.mydreambakery.biz/gallery/thumbnails.php?album=8&page=1&sort=na and finally back to http://www.mydreambakery.biz/gallery/thumbnails.php?album=8&page=1&sort=pa
What are the numbers meant to do? They won't help you in enabling your customers to specify a particular product for ordering or refering to it. The only way to accomplish that is by using the unique ID - think of it as an article number.
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #8 on: January 12, 2010, 09:03:01 pm »

WOW! That's perfect man. Thanks.. 
Mom wants each cake to be numbered so that people can just give her a number in a selected album.  Also, if I'm to give a title to each cake,  it would take too long to title them all now since there are hundreds of them; and also if one is removed then it throws the numbering off.  This solution you've kindly provided allows the images to be numbered dynamically.  Now I'm looking to start the number starting with "1" rather than "0".  Thanks for all your time man!
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #9 on: January 13, 2010, 12:03:12 am »

I think that I have to make some changes in the displayimage.php for the numbering to start with "1" rather than "0". 
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Gallery Thumbnail Ascending Title Number
« Reply #10 on: January 13, 2010, 08:49:22 am »

Mom wants each cake to be numbered so that people can just give her a number in a selected album.
And that's what is impossible if you use the position inside an album - obviously you haven't tried the links I posted that will re-sort your album and your numbering scheme! It's mandatory to use the unique id, i.e. the initial code I posted. If you don't, people will get something else than what they ordered. I'm begging you: please don't do what you're trying to do. Use the article number idea I posted like this
Code: [Select]
<?php

function theme_display_thumbnails(&$thumb_list$nbThumb$album_name$aid$cat$page$total_pages$sort_options$display_tabs$mode 'thumb')

{

    global 
$CONFIG;

    global 
$template_thumb_view_title_row,$template_fav_thumb_view_title_row$lang_thumb_view$template_tab_display$template_thumbnail_view$lang_album_list;



    static 
$header '';

    static 
$thumb_cell '';

    static 
$empty_cell '';

    static 
$row_separator '';

    static 
$footer '';

    static 
$tabs '';

    static 
$spacer '';



    if (
$header == '') {

        
$thumb_cell template_extract_block($template_thumbnail_view'thumb_cell');

        
$tabs template_extract_block($template_thumbnail_view'tabs');

        
$header template_extract_block($template_thumbnail_view'header');

        
$empty_cell template_extract_block($template_thumbnail_view'empty_cell');

        
$row_separator template_extract_block($template_thumbnail_view'row_separator');

        
$footer template_extract_block($template_thumbnail_view'footer');

        
$spacer template_extract_block($template_thumbnail_view'spacer');

    }



    
$cat_link is_numeric($aid) ? '' '&amp;cat=' $cat;

    
$uid_link = (isset($_GET['uid']) && is_numeric($_GET['uid'])) ? '&amp;uid=' $_GET['uid'] : '';



    
$theme_thumb_tab_tmpl $template_tab_display;



    if (
$mode == 'thumb') {

        
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $aid == 'lastalb' $lang_album_list['album_on_page'] : $lang_thumb_view['pic_on_page']));

        
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));

        
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));

        
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' $aid $cat_link $uid_link '&amp;page=%d'));

    } else {

        
$theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));

        
$theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));

        
$theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));

        
$theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' $cat '&amp;page=%d'));

    }



    
$thumbcols $CONFIG['thumbcols'];

    
$cell_width ceil(100 $CONFIG['thumbcols']) . '%';



    
$tabs_html $display_tabs create_tabs($nbThumb$page$total_pages$theme_thumb_tab_tmpl) : '';

    
// The sort order options are not available for meta albums

    
if ($sort_options) {

        
$param = array('{ALBUM_NAME}' => $album_name,

            
'{AID}' => $aid,

            
'{PAGE}' => $page,

            
'{NAME}' => $lang_thumb_view['name'],

            
'{TITLE}' => $lang_thumb_view['title'],

            
'{DATE}' => $lang_thumb_view['date'],

            
'{SORT_TA}' => $lang_thumb_view['sort_ta'],

            
'{SORT_TD}' => $lang_thumb_view['sort_td'],

            
'{SORT_NA}' => $lang_thumb_view['sort_na'],

            
'{SORT_ND}' => $lang_thumb_view['sort_nd'],

            
'{SORT_DA}' => $lang_thumb_view['sort_da'],

            
'{SORT_DD}' => $lang_thumb_view['sort_dd'],

            
'{POSITION}' => $lang_thumb_view['position'],

            
'{SORT_PA}' => $lang_thumb_view['sort_pa'],

            
'{SORT_PD}' => $lang_thumb_view['sort_pd'],

            );

        
$title template_eval($template_thumb_view_title_row$param);

    } else if (
$aid == 'favpics' && $CONFIG['enable_zipdownload'] == 1) { //Lots of stuff can be added here later

       
$param = array('{ALBUM_NAME}' => $album_name,

                             
'{DOWNLOAD_ZIP}'=>$lang_thumb_view['download_zip']

                               );

       
$title template_eval($template_fav_thumb_view_title_row$param);

    }else{

        
$title $album_name;

    }





    if (
$mode == 'thumb') {

        
starttable('100%'$title$thumbcols);

    } else {

        
starttable('100%');

    }



    echo 
$header;



    
$i 0;

    foreach(
$thumb_list as $thumb) {

        
$i++;

        if (
$mode == 'thumb') {

            if (
$aid == 'lastalb') {

                
$params = array('{CELL_WIDTH}' => $cell_width,

                    
'{LINK_TGT}' => "thumbnails.php?album={$thumb['aid']}",

                    
'{THUMB}' => $thumb['image'],

                    
'{CAPTION}' => $thumb['caption'],

'{UNIQUE_ID}' => $thumb['pid'],

                    
'{ADMIN_MENU}' => $thumb['admin_menu']

                    );

            } else {

                
$params = array('{CELL_WIDTH}' => $cell_width,

                    
'{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&amp;pos={$thumb['pos']}$uid_link",

                    
'{THUMB}' => $thumb['image'],

                    
'{CAPTION}' => $thumb['caption'],

'{UNIQUE_ID}' => $thumb['pid'],

                    
'{ADMIN_MENU}' => $thumb['admin_menu']

                    );

            }

        } else {

            
$params = array('{CELL_WIDTH}' => $cell_width,

                
'{LINK_TGT}' => "index.php?cat={$thumb['cat']}",

                
'{THUMB}' => $thumb['image'],

                
'{CAPTION}' => $thumb['caption'],

                
'{ADMIN_MENU}' => ''

                
);

        }

        echo 
template_eval($thumb_cell$params);



        if (((
$i $thumbcols) == 0) && ($i count($thumb_list))) {

            echo 
$row_separator;

        }

    }

    for (;(
$i $thumbcols); $i++) {

        echo 
$empty_cell;

    }

    echo 
$footer;



    if (
$display_tabs) {

        
$params = array('{THUMB_COLS}' => $thumbcols,

            
'{TABS}' => $tabs_html

            
);

        echo 
template_eval($tabs$params);

    }



    
endtable();

    echo 
$spacer;

}



// HTML template for thumbnails display

$template_thumbnail_view = <<<EOT



<!-- BEGIN header -->

        <tr>

<!-- END header -->

<!-- BEGIN thumb_cell -->

        <td valign="top" class="thumbnails" width ="{CELL_WIDTH}" align="center">

                <table width="100%" cellpadding="0" cellspacing="0">

                        <tr>

                                <td align="center">

                                        <a href="{LINK_TGT}">{THUMB}<br /></a>

                                        {CAPTION}

                                        {ADMIN_MENU}

<span title="Please provide this number with your orders">Art.-No.: <span class="uniqueid">{UNIQUE_ID}</span></span>

                                </td>

                        </tr>

                </table>

        </td>

<!-- END thumb_cell -->

<!-- BEGIN empty_cell -->

                <td valign="top" class="thumbnails" align="center">&nbsp;</td>

<!-- END empty_cell -->

<!-- BEGIN row_separator -->

        </tr>

        <tr>

<!-- END row_separator -->

<!-- BEGIN footer -->

        </tr>

<!-- END footer -->

<!-- BEGIN tabs -->

        <tr>

                <td colspan="{THUMB_COLS}" style="padding: 0px;">

                        <table width="100%" cellspacing="0" cellpadding="0">

                                <tr>

                                       {TABS}

                                </tr>

                        </table>

                </td>

        </tr>

<!-- END tabs -->

<!-- BEGIN spacer -->

        <img src="images/spacer.gif" width="1" height="7" border="" alt="" /><br />

<!-- END spacer -->



EOT;

?>

Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #11 on: January 13, 2010, 08:43:02 pm »

Okay! I'm willing to try anything to reach this goal.  What page does this code belong to?  Am I to keep the edited theme you provided and add this code to the appropriate page?  Thanks man!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Gallery Thumbnail Ascending Title Number
« Reply #12 on: January 14, 2010, 06:05:54 pm »

The code in my previous posting replaces the code in themes/winterdreams/theme.php
Use a plain text editor to edit that file. Notepad.exe is fine. MS frontpage is not a plain text editor, nor are MS Winword or similar applications valid editors.
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #13 on: January 14, 2010, 06:23:44 pm »

Thanks man! This code placed numbers at under thumbnails, but now they are all out of oder.  darn!!  i wish i could somehow just start the number from 1 rather than 0 somewhere in the code..  why does it even begin with a "0" to begin with?   

if i'm to use this code you gave, how am i to batch name or order them to start form 1?  Is there a link of an article you've written in the forums?  I'm so close to having it work properly.  the current code works perfect, just that it should start with "1"..  so close.... 

can you give me steps as to what to do?   
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Gallery Thumbnail Ascending Title Number
« Reply #14 on: January 14, 2010, 07:11:55 pm »

This is my final attempt to explain this: you can not have ascending numbers on that thumbnail list if you want those number to be unique, i.e. if visitors are supposed to refer to those number when ordering. They are just numbers. Your visitors won't care at all in what order they are. People are used to article numbers in other fields, they don't have an issue with that.
Reason: coppermine is a database-driven application. Coppermine creates thumbnail views on the fly. It creates many of them (a nearly infinite number), as it comes with many, many features (liek sorting, all kinds of meta albums, pagination etc.) that have an impact on how the list ist sorted and thus displayed. Even if you used another numbering system or even if you assigned numbers to all of your images (products) manually, coppermine would be creating a nearly infinite number of alternative views where you neatly ordered list would be scrambled, i.e. the numbers would not be in the right order. That doesn't matter as long as number 12345 always appears with the same image.

I can see that you still have the pos ordering in place, so please do me a favor and take a look at the alternative views I posted above. Focus on a particular cake, e.g. the Spiderman cake (http://www.mydreambakery.biz/gallery/displayimage.php?pos=-112), ok? It should have the ID 112 (if you use the pid ordering as I suggested), but it doesn't:And the worst thing is: this will change as well if you add new images.

So please, please, please: forget the idea with the number starting at one and going up. That's a silly idea. Your site's visitors are probably cake-lovers, I don't think that they care too much for nicely ordered article numbers.
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #15 on: January 15, 2010, 12:14:51 am »

Joachim,

First, I can't thank you enough for your time. 

What we need to happen is very simple.  We want customers to click on an album like this one: http://www.mydreambakery.biz/gallery/thumbnails.php?album=8&page=1&sort=ta

Select a cake like say Number "9", click on it, and see it bigger.  Unfortunately as of now, when a customer clicks on the "9" thumbnail, the following page http://www.mydreambakery.biz/gallery/displayimage.php?album=8&pos=9   the ITEM 10/207 does not match the previous page. 

Now, I've taken out the user sort option out of the theme.php file, because we don't need users to sort anything.. Just get on to the gallery, select a cake, and tell us that they want a cake they saw in the gallery.. So right now the numbers don't match.  I mean I'm sure there's a way to change one of those numbers so that the picture number matches.   

When you recommend for me to ad unique ID do you mean one by one?  We just don't have time to go through and name photos one by one.   Perhaps there's a plugin that either goes through albums and sorts them so that the thumbnail ID's match the "display" page. 

I wont beat this in the head any longer. 

Much Thanks!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Gallery Thumbnail Ascending Title Number
« Reply #16 on: January 15, 2010, 09:20:19 am »

When you recommend for me to ad unique ID do you mean one by one? 
All images in your gallery already have a unique ID that we just output on the thumbnail page if you use my suggestion (replies 3 and 10 in this thread) instead of your foolish position reference. If you want to display that unique ID on the displayimage as well, you'll need another small modification of theme.php: the pid (short for "picture ID") already resides in the database and coppermine page is "aware" of that unique number. Usually, you just don't display it, as nobody ever needed it before. However, it's dead easy to display it anywhere you want. No need to manually edit the database and add stuff there.
Determine where exactly in the output the pid is supposed to show (attach a screenshot to your posting that highlights where you want it to appear) and I can come up with the needed code in no time.
You haven't said before that the unique id is supposed to show up on displayimage as well, that's why it doesn't. Please stop behaving difficult or I will stop supporting you.
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #17 on: January 15, 2010, 06:41:36 pm »

I feel that questions are never foolish, but rather help people and technology grow.  I doubt that other Cop. Gallery users have never needed what I need with my gallery.

I understand that each image has a unique ID.  When I applied your script it displayed all the images and the unique ID, but all the numbers were all wacked.  It took all the thumbnails and displayed the ID number from 1 to whatever as though all the albums were as one.  When I applied your script for example I click on the first album and there were thumbnails with numbers of 734 or 459 rather than just 15 or 16.  It took all the pictures in the database and assigned the unique ID which is good but not what we need.

I tried your approach, and it just took all the thumbnails and displayed their unique ID which doesn't number them appropriately starting with "1" to "x" dynamically.  I'm quite close with the first solution, only that it begins with "0". 

What code must be written so that each album displays the thumbnails' unique ID in an incremental order?  Is this possible? Can we manipulate the unique ID to behave as I'm requesting?

Am i making sense here?  Isn't an dynamically increasing numbering of thumbnails ever needed in a gallery?   
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Gallery Thumbnail Ascending Title Number
« Reply #18 on: January 19, 2010, 10:38:29 am »

Am i making sense here?
No, you're not making sense at all.
I'm bailing out of this thread: I get the feeling that you're trying to upset me with your reluctance that you can not have have the IDs starting from 1 on each page and that they can not be in ascending order. Judging from your rant about the IDs showing on your page not starting from zero or one and that you still haven't understood why they are not in order shows that you haven't understood a single word of my explanations. Another possible explanation would be that you're a troll. Anyway, I'm giving up on you. Thread is open. Someone else is welcome to try to make larrpan understand the obvious and accept the inevitable.
Over and out :o

Joachim
Logged

larrpan

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: Gallery Thumbnail Ascending Title Number
« Reply #19 on: January 19, 2010, 09:23:04 pm »

Well, again thanks for your time and expertise.  We're just discussing possibilities of technology not personal naming or attacks.  I'm sorry for not understanding your approach to solving this usability need, but I request that you don't take it personally.  I'm not intently causing your heart to boil to frustration.  I'm just trying to find the best way to solving this issue.  Am I to just go step by step and name each image or what?

I just may have to live with thumbnails starting from "0".   

Take care man! 
Logged
Pages: [1]   Go Up
 

Page created in 0.033 seconds with 20 queries.