Advanced search  

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

Pages: [1] 2   Go Down

Author Topic: How to set thumbnail of an empty / keyword album?  (Read 9972 times)

0 Members and 1 Guest are viewing this topic.

parabola

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
How to set thumbnail of an empty / keyword album?
« on: December 03, 2007, 01:59:25 pm »

You can set the album thumbnail manually in the db if you feel comfortable doing that. For the album list view, either enable the config option to show the number of linked file or search the board for instructions to remove it completely.

I tried updating the thumb field in the table cpg_albums but it still won't use them as the thumbnail. Do I need to something else to make that happen?

Any help would be appreciated!

Regards,
parabola
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to set thumbnail of an empty / keyword album?
« Reply #1 on: December 03, 2007, 02:12:35 pm »

I tried updating the thumb field in the table cpg_albums
What exactly did you do? Post your changes. A deep link to the page in question might help as well.
Logged

parabola

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: How to set thumbnail of an empty / keyword album?
« Reply #2 on: December 03, 2007, 07:55:31 pm »

Ok, here's the page in question: http://hillmanchan.net/cphoto/index.php?cat=11

As u can see, there's no thumbnail for the album "A Bug's Life". To confirm that, I ran the SQL:

SELECT thumb FROM cpg_albums WHERE aid = 95

and thumb returns 0. So I changed thumb:

UPDATE cpg_albums SET thumb =7362 WHERE aid =95

Image 7362 is the one I used for another album, so I'm pretty sure that it exists: http://hillmanchan.net/cphoto/displayimage.php?pos=-7362

My suspicion is, there could be some piece of code that always not use a album thumbnail when it's empty.... or do I need to update somewhere else?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to set thumbnail of an empty / keyword album?
« Reply #3 on: December 04, 2007, 08:25:44 am »

Why do you run queries instead of just using the album properties screen?
You are running cpg1.4.10 btw, while the most recent stable release is cpg1.4.14 - upgrading is mandatory!
Logged

parabola

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: How to set thumbnail of an empty / keyword album?
« Reply #4 on: December 04, 2007, 09:23:10 am »

The album properties screen says "Album is empty" and won't let me choose a thumbnail.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to set thumbnail of an empty / keyword album?
« Reply #5 on: December 04, 2007, 09:25:24 am »

What's the use of an empty album having a thumbnail assigned to it?
Logged

parabola

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: How to set thumbnail of an empty / keyword album?
« Reply #6 on: December 04, 2007, 12:57:33 pm »

It's a keyword album. U don't add any pictures into it. Just specify a keyword for the album and it'll pick up all photos with that keyword.

Check this link and open the album: http://hillmanchan.net/cphoto/index.php?cat=11
Logged

parabola

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: How to set thumbnail of an empty / keyword album?
« Reply #7 on: December 05, 2007, 08:30:17 am »

Why do you run queries instead of just using the album properties screen?
You are running cpg1.4.10 btw, while the most recent stable release is cpg1.4.14 - upgrading is mandatory!

I just upgraded to 1.4.14 from 1.4.10 but it still shows no thumbnail for these albums.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to set thumbnail of an empty / keyword album?
« Reply #8 on: December 05, 2007, 08:31:37 am »

Documentation > Known Issues:
Quote
No album thumbnails for albums that contain only pics linked by keyword
Logged

parabola

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: How to set thumbnail of an empty / keyword album?
« Reply #9 on: December 05, 2007, 11:19:25 am »

No wonder... I had a look in index.php and "Inserts a thumbnail if the album contains 1 or more images" looks more like a feature than a known issue. Anyway, I've hacked it shows the album thumbnails OK now! Here's the patch:

Code: [Select]
$ diff -uN index.php index.php.new
--- index.php   2007-12-05 18:07:07.911450000 +0800
+++ index.php.new       2007-12-05 18:09:37.799344000 +0800
@@ -498,7 +498,7 @@
         $visibility = $alb_thumb['visibility'];
 
                 if (!in_array($aid,$FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) {
-            if ($count > 0) {
+            if (true) {
                 if ($alb_thumb['filename']) {
                     $picture = &$alb_thumb;
                 } else {
@@ -660,7 +660,7 @@
         // Inserts a thumbnail if the album contains 1 or more images
         $visibility = $alb_thumb['visibility'];
                 if (!in_array($aid,$FORBIDDEN_SET_DATA) || $CONFIG['allow_private_albums'] == 0) { //test for visibility
-            if ($count > 0) { // Inserts a thumbnail if the album contains 1 or more images
+            if (true) { // Inserts a thumbnail if the album contains 1 or more images
                 if ($alb_thumb['filename']) {
                     $picture = &$alb_thumb;
                 } else {

Should it be included in the next release? Or would it break something else by doing that?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: How to set thumbnail of an empty / keyword album?
« Reply #10 on: December 06, 2007, 07:48:31 am »

You would have to come up with a method to allow users to select the thumbnail from the properties screen as well. The method you perform (modifying the database itself) is not what you can expect from regular users.
Logged

adipisicing

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: How to set thumbnail of an empty / keyword album?
« Reply #11 on: January 05, 2008, 09:31:39 pm »

Is anyone currently using this patch? Does it cause any problems?

I understand it isn't a complete solution, but it seems like the least modification necessary to give thumbnails to empty albums.
Logged
Unless otherwise noted, all code that I post on these forums to which I hold the copyright is released under the GPLv2.

adipisicing

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Re: How to set thumbnail of an empty / keyword album?
« Reply #12 on: January 08, 2008, 12:10:20 am »

I've applied this patch to my gallery installation. Everything seems to be working fine (so far, at least).

Keep in mind that, with this patch, empty albums whose thumbnails have not been manually set by modifying the database display no thumbnail image, instead of the placeholder image they normally do.
Logged
Unless otherwise noted, all code that I post on these forums to which I hold the copyright is released under the GPLv2.

adipisicing

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Caveats Re: How to set thumbnail of an empty / keyword album?
« Reply #13 on: January 08, 2008, 12:51:21 am »

Everything seems to be working fine

Of course, I spoke too soon.

Updating the properties for an "empty" album will make the database forget the custom thumbnail you applied.

I should be able to find a workaround to this.
Logged
Unless otherwise noted, all code that I post on these forums to which I hold the copyright is released under the GPLv2.

adipisicing

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 24
Workaround Re: How to set thumbnail of an empty / keyword album?
« Reply #14 on: January 08, 2008, 02:41:13 am »

Workaround found.

in modifyalb.php in form_alb_thumb:
change
Code: [Select]
                        <input type="hidden" name="$name" value="0" />
to
Code: [Select]
                        <input type="hidden" name="$name" value="$ALBUM_DATA[$name]" />
This is line 205 as of cpg 1.4.14.

After applying this workaround, updating the properties of an "empty" album will preserve the album's existing custom thumbnail.

Logged
Unless otherwise noted, all code that I post on these forums to which I hold the copyright is released under the GPLv2.

parabola

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: How to set thumbnail of an empty / keyword album?
« Reply #15 on: June 17, 2008, 04:35:33 am »

Hi adipisicing,

I tried your workaround for modifyalb.php in 1.4.18 and found no problem with it so far. Thanks for the contribution!

Regards,
parabola
Logged

Ludo

  • Contributor
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 706
    • E+GiElle
Re: How to set thumbnail of an empty / keyword album?
« Reply #16 on: July 09, 2008, 12:33:36 pm »

You would have to come up with a method to allow users to select the thumbnail from the properties screen as well.
Done! ;)
Here is a mod that will display in the thumbnail selection listbox, for all albums, both uploaded and linked files.

DEMO: http://vanrokken.altervista.org/ (Album Fiori)

FILES TO EDIT: 2
index.php
modifyalb.php


OPEN
index.php

FIND (2 times)
Code: [Select]
if ($count > 0) {
REPLACE WITH
Code: [Select]
if ($count > 0 || $alb_stat['link_pic_count'] > 0) {

OPEN
modifyalb.php

FIND
Code: [Select]
    global $CONFIG, $ALBUM_DATA, $album, $lang_modifyalb_php,$USER_DATA;
REPLACE WITH
Code: [Select]
    global $CONFIG, $ALBUM_DATA, $album, $lang_modifyalb_php, $USER_DATA, $FORBIDDEN_SET_DATA;
FIND
Code: [Select]
    $results = cpg_db_query("SELECT pid, filepath, filename, url_prefix FROM {$CONFIG['TABLE_PICTURES']} WHERE aid='$album' AND approved='YES' ORDER BY filename");
REPLACE WITH
Code: [Select]
    (count($FORBIDDEN_SET_DATA) > 0) ? $forbidden_set_string = "AND aid NOT IN (".implode(",", $FORBIDDEN_SET_DATA).")" : $forbidden_set_string = '';   
    ($ALBUM_DATA['keyword']) ? $where_string = " (aid='$album' OR (keywords LIKE '%{$ALBUM_DATA['keyword']}%' $forbidden_set_string))" : $where_string = "aid='$album'";       
    $results = cpg_db_query("SELECT pid, filepath, filename, url_prefix FROM {$CONFIG['TABLE_PICTURES']} WHERE $where_string AND approved='YES' ORDER BY filename");


SAVE AND CLOSE ALL FILES

EDIT: added check on private albums. I don't have any private album on my gallery, so I can't test it
« Last Edit: July 11, 2008, 12:16:06 am by Ludo »
Logged

GH

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 107
Re: How to set thumbnail of an empty / keyword album?
« Reply #17 on: September 27, 2008, 01:34:35 pm »

I need to have on my only linked images album named "fuori"I an album thumbnail. I tried the mod by ludo, but there is no result for me. Running in the admin tool the fonction for creating thumbnails for the album has no result on my public album with only linked files ??
It appears:

Updating thumbnails and/or resized images, please wait...
albums/fuori/thumb_GALLERATI_Compressore.jpg updated succesfully !
albums/fuori/normal_GALLERATI_Compressore.jpg updated succesfully !
albums/fuori/thumb_GALLERATI_Grandialberghi.jpg updated succesfully !
albums/fuori/normal_GALLERATI_Grandialberghi.jpg updated succesfully !
albums/fuori/thumb_Muenchen_Kreillerstrasse_20x30.jpg updated succesfully !
albums/fuori/normal_Muenchen_Kreillerstrasse_20x30.jpg updated succesfully !
albums/fuori/thumb_Muenchen_Josephsburg_DSC2502_.jpg updated succesfully !
albums/fuori/normal_Muenchen_Josephsburg_DSC2502_.jpg updated succesfully !
albums/metro/thumb_Madrid_Nuevos_Ministerios__DSC3224.jpg updated succesfully !
albums/metro/normal_Madrid_Nuevos_Ministerios__DSC3224.jpg updated succesfully !
albums/metro/thumb_Lyon_place_Jean_Jaur_s__DSC0854.jpg updated succesfully !
albums/metro/normal_Lyon_place_Jean_Jaur_s__DSC0854.jpg updated succesfully !
albums/metro/thumb_Lisboa_Saldanha__DSC5030.jpg updated succesfully !
albums/metro/normal_Lisboa_Saldanha__DSC5030.jpg updated succesfully !
albums/metro/thumb_Lisboa_Bela_Vista__DSC4784.jpg updated succesfully !
albums/metro/normal_Lisboa_Bela_Vista__DSC4784.jpg updated succesfully !
albums/metro/thumb_Madrid_Nuevos_Ministerios__DSC3312.jpg updated succesfully !
albums/metro/normal_Madrid_Nuevos_Ministerios__DSC3312.jpg updated succesfully !
albums/metro/thumb_U_Bahn_Essen_HBF__DSC1285.jpg updated succesfully !
albums/metro/normal_U_Bahn_Essen_HBF__DSC1285.jpg updated succesfully !
albums/metro/thumb_U_Bahn_Essen_HBF__DSC1262.jpg updated succesfully !
albums/metro/normal_U_Bahn_Essen_HBF__DSC1262.jpg updated succesfully !
albums/metro/thumb_U_Bahn_Muenchen_Gern__DSC9642_.jpg updated succesfully !
albums/metro/normal_U_Bahn_Muenchen_Gern__DSC9642_.jpg updated succesfully !

back to main

So I believe that this function create the image thumbnails inside the albums, but not the thumbnail of the album, true? How to do to have the album thumbnail?
Logged

Ludo

  • Contributor
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 706
    • E+GiElle
Re: How to set thumbnail of an empty / keyword album?
« Reply #18 on: September 27, 2008, 05:25:17 pm »

After applying mod, you should select album thumbnail in Album properties page, exactly like for albums with uploaded pictures. There is no point in updating thumbnails with Admin tools.
« Last Edit: September 27, 2008, 05:31:22 pm by Ludo »
Logged

GH

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 107
Re: How to set thumbnail of an empty / keyword album?
« Reply #19 on: September 27, 2008, 05:49:07 pm »

thanks,  very simple and a good solution !!
Logged
Pages: [1] 2   Go Up
 

Page created in 0.026 seconds with 20 queries.