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: Linked Files to album thumbnails  (Read 12819 times)

0 Members and 1 Guest are viewing this topic.

OmegaGOD

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • I approve.
Linked Files to album thumbnails
« on: April 25, 2005, 04:29:10 am »

This is a feature request with reference to "Topic: One picture in various albums (keyword reference)" from the dev testing board http://forum.coppermine-gallery.net/index.php?topic=8020.0

Sorry linked files are just that linked and not in albums - can't have that as album thumbnails - atleast not this version

How about adding a feature that would allow linked files to be album thumbnails? I think this would be a very important feature. The entire notion of being able to have one picture in multiple albums is to actually have that picture in multiple albums. For example, consider the two albums Sky Scrapers and New York City. It would be great if we could use the picture of the Empire State Building as the album thumbnail for both albums.
Logged
Please do not PM me with support questions. Please read the manual and then if posting questions please place them in the proper sub-boards.

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Linked Files to album thumbnails
« Reply #1 on: April 25, 2005, 04:41:13 am »

I figured out how to make linked images album thumbnails, but I ran into some bugs, which I can't recall completely. You can see a couple of keyword only albums that have thumbnails here.

One was that if no album thumbnail was selected, no image will show up where the thumbnail would be. No last uploaded image or 'no pic'.

And I don't know if it's related to my coding, but the file count does not show for one of the albums. I see this in another v 1.4 install that does not have my modification, so I don't think it is due to that.
Logged

OmegaGOD

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • I approve.
Re: Linked Files to album thumbnails
« Reply #2 on: April 25, 2005, 04:51:45 am »

Hey Tranz,

Yea I see that you were able to set linked files as album thumbs. Awesome!  :) Is this feature planned to be committed to CPG 1.5.x? What modifications did you make? Did you code it so linked files would be listed under the "album thumbnail" drop-down box?
Logged
Please do not PM me with support questions. Please read the manual and then if posting questions please place them in the proper sub-boards.

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Linked Files to album thumbnails
« Reply #3 on: April 25, 2005, 04:55:49 am »

Yes, I coded it so that the linked files would show up in the dropdown box. I haven't committed it due to bugs. :-\\

I would love to see this in 1.5, though.

I'll post the modifications some time. I'm on my desktop right now and the code is on my laptop.
Logged

OmegaGOD

  • Supporter
  • Coppermine frequent poster
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 346
  • I approve.
Re: Linked Files to album thumbnails
« Reply #4 on: April 25, 2005, 05:03:45 am »

Bugs... if only i had a fly swatter ;) Let me know if you want some help bug-hunting.
Logged
Please do not PM me with support questions. Please read the manual and then if posting questions please place them in the proper sub-boards.

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Linked Files to album thumbnails
« Reply #5 on: May 29, 2005, 09:06:14 pm »

In modifyalb.php, in function form_alb_thumb($text, $name)

REPLACE:
Code: [Select]
        echo <<<EOT
        <tr>
                <td class="tableb" valign="top">
                        $text
                </td>
                <td class="tableb" valign="top">
                        <i>{$lang_modifyalb_php['alb_empty']}</i>
                        <input type="hidden" name="$name" value="0">
                </td>
        </tr>

EOT;
        return;

WITH:
Code: [Select]
    $results = cpg_db_query("SELECT pid, filepath, filename, url_prefix FROM {$CONFIG['TABLE_PICTURES']} WHERE approved='YES' AND keywords like '%{$ALBUM_DATA['keyword']}%' ORDER BY filename");
/*    echo <<<EOT
        <tr>
                <td class="tableb" valign="top">
                        $text
                </td>
                <td class="tableb" valign="top">
                        <i>{$lang_modifyalb_php['alb_empty']}</i>
                        <input type="hidden" name="$name" value="0">
                </td>
        </tr>

EOT;
        return;*/



The functions to work with in index.php are list_albums() and list_cat_albums($cat = 0).

I managed to fix the "no thumbnail selected" issue for thumbnails that belong to categories to show up when the thumbnails are from keyword albums. However, I don't know how to make it work when an album is not in a category, or is $cat=0. Basically, list_albums() seems to work as it should, but I don't know how to get the same result from list_cat_albums($cat = 0).

edits for list_albums():
FIND:
Code: [Select]
    global $cat;REPLACE with:
Code: [Select]
    global $cat, $link_pic_count;
FIND:
Code: [Select]
} else { // Inserts an empty thumbnail if the album contains 0 images
BEFORE it, ADD:
Code: [Select]
            } elseif ($link_pic_count > 0) {
                if ($alb_thumb['filename']) {
                    $picture = &$alb_thumb;
$pic_url = get_pic_url($picture, 'thumb');
$image_size = compute_img_size($picture['pwidth'], $picture['pheight'], $CONFIG['alb_list_thumb_size']);
$alb_list[$alb_idx]['thumb_pic'] = "<img src=\"" . $pic_url . "\" class=\"image\" {$image_size['geom']} border=\"0\" alt=\"{$picture['filename']}\" />";
                } else {
$cpg_nopic_data = cpg_get_system_thumb('nopic.jpg', $alb_thumb['category']);
$alb_list[$alb_idx]['thumb_pic'] = '<img src="' . $cpg_nopic_data['thumb'] . '" ' . $cpg_nopic_data['whole'] . ' class="image" border="0" alt="" />';
}

To see a keyword album with a thumbnail in cat 0, edit the function:
FIND:
Code: [Select]
if ($count > 0)REPLACE with:
Code: [Select]
if ($count >= 0)
That's not good code since it doesn't take into account when no thumbnail is assigned. However, it's good for troubleshooting to make sure that the assigned thumbnail is being recognized.
Logged

jerx

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 85
Re: Linked Files to album thumbnails
« Reply #6 on: February 02, 2006, 09:34:11 am »

Does this code change fix the no thumbnail and pic count issue on keyword albums?

I added this code, but although I can set the album thumbnail on the keyword album, I don' t see the thumbnail. The pic count is still 0, so that nobody expects to see pictures in the keyword album.

I am using version 1.43 and Stramm' s mod pack. I modified the file modifyalb.php and index.php of the mod pack according to the instructions in the previous post. I have set two categories (a and b) and two albums (a and b). The category b is the keyword albums category.

Edit: I just noticed that the thumbnail is shown, if you have clicked the keyword category. My hierarchy is also a little bit different than I have written. I have 2 main categories (cat_a and cat_b), one for real albums and one for linked albums. In each category is a sub-category (sub_a and sub_b). Each sub category contains an album (album_a and album_b). The whole b tree is for the keyword feature.
At top level I can see the two categories and their sub categories. It shows correctly that each sub category has 1 album. The only error is that the pic count for the keyword album is wrong. It says 0 pictures.
If you go into category b, the the subcategory b and the keyword album b is shown with a thumbnail. Again, pics are not counted and shows 0.
If you go into subcategory b, you see the keyword album b without showing the thumbnail. Pics are not counted.
If you go into album b, thumbnail view is correct. The only problem I see here is that the link to the full size picture points into the real album a. It is not big deal for me, because real and keyword album contain the same pictures. But there might be users who don' t have the same pictures. Then the visitors will be confused and browsing a keyword album will be very unpleasant. You will not be able to use the forward buttons of coppermine, but you would have to do this: Click the fullsize image, click the back button of your browser, remember which picture you have just seen, etc.
« Last Edit: February 02, 2006, 10:06:21 am by jerx »
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Linked Files to album thumbnails
« Reply #7 on: February 02, 2006, 01:53:31 pm »

You need to go into Config and say yes to showing the count for linked files. Not related to this code.
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 18 queries.