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] 2   Go Down

Author Topic: Setting the album thumbnails NOT to show in Random Files  (Read 20100 times)

0 Members and 1 Guest are viewing this topic.

ComplexRetribution

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • Hearts of Oak
Setting the album thumbnails NOT to show in Random Files
« on: September 18, 2004, 02:23:51 am »

I have fixed my album thumbnails to certain pictures that I don't really want as gallery images. I want them just to represent the albums. In order to this I have to upload them as pictures and then select them as representing the album from admin rather than have it show the last uploaded image. This is fine, I don't really have a problem with that since I titled them "Album Thumbnail Only" to let visitors know that they are not part of my gallery.

The problem comes though because I have random files turned on in the main page. Regular as clockwork these files are shown a part of the random images. Is there any way to prevent a picture being shown in the random files? I've searched through the forums but couldn't find an answer. Any help appreciated!
« Last Edit: September 19, 2004, 02:18:14 am by GauGau »
Logged
I thought I saw a light at the end of the tunnel, but it was just some bastard with a torch bringing me more work.
Chi Verace Durera
___________________________________________________________________
FREE SCRIPTS for webmasters - http://www.liquidfrog.com

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #1 on: September 18, 2004, 02:33:40 am »

I have a different scenario but am also adversely effected by random files. I have panaramic photos but if their thumbnails show up in Random, it messes up my page layout. I'm guessing that we might have to hardcode an if statement to keep certain images from showing. I can take a look at it unless a CPG code expert can figure it out more quickly.
Logged

Nibbler

  • Guest
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #2 on: September 18, 2004, 02:36:45 am »

You can find the query to grab the random pics in include/functions.inc.php

Code: [Select]
$sql = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $ALBUM_SET ORDER BY RAND() LIMIT $limit2";
If you want to exclude pics with the title 'Album Thumbnail Only' then change the query accordingly.

Code: [Select]
$sql = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE title <> 'Album Thumbnail Only' AND approved = 'YES' $ALBUM_SET ORDER BY RAND() LIMIT $limit2";
Logged

Nibbler

  • Guest
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #3 on: September 18, 2004, 02:39:04 am »

You could do a similar thing using pwidth to block the panoramic pics.
Logged

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #4 on: September 18, 2004, 03:39:15 am »

In conjunction with the solution in the other thread, I can at last have stitched photos in my gallery without mucking up my layout. Thank you so much, Nibbler! (http://tu2.net/forums/images/smiles/icon_clap.gif)
« Last Edit: October 28, 2005, 08:45:18 am by TranzNDance »
Logged

ComplexRetribution

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • Hearts of Oak
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #5 on: September 18, 2004, 11:04:44 am »

Hey Nibbler,

Great work - that was perfect, thanks!  8)

Now another question if I may. If it is possible to do this I guess it's possible to set the same album images to NOT show up in the gallery either. Any idea which lines I would need to edit for that?
Logged
I thought I saw a light at the end of the tunnel, but it was just some bastard with a torch bringing me more work.
Chi Verace Durera
___________________________________________________________________
FREE SCRIPTS for webmasters - http://www.liquidfrog.com

ComplexRetribution

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • Hearts of Oak
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #6 on: September 18, 2004, 11:34:16 am »

Ok, no worries I found it. ;)

For others who may need to do the same thing find this line:

Code: [Select]
$result = db_query("SELECT $select_columns from {$CONFIG['TABLE_PICTURES']} WHERE aid='$album' $keyword $approved $ALBUM_SET ORDER BY $sort_order $limit");
and replace it with:

Code: [Select]
$result = db_query("SELECT $select_columns from {$CONFIG['TABLE_PICTURES']} WHERE title <> 'Album graphic' AND aid='$album' $keyword $approved $ALBUM_SET ORDER BY $sort_order $limit");
Logged
I thought I saw a light at the end of the tunnel, but it was just some bastard with a torch bringing me more work.
Chi Verace Durera
___________________________________________________________________
FREE SCRIPTS for webmasters - http://www.liquidfrog.com

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #7 on: September 18, 2004, 02:35:35 pm »

And thank you for that suggestion, ComplexRetribution!  :D I think all these modifications should be combined in one thread on how to make CPG panorama-photo-friendly. :)
Logged

ComplexRetribution

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • Hearts of Oak
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #8 on: September 18, 2004, 02:51:43 pm »

You're welcome there TranzNDance. Further to this, you can also set it so that these images don't appear in the Last Uploads.

Find this line:
Code: [Select]
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE  approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");
and replace it with this line:
Code: [Select]
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE title <> 'Album graphic' AND approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");
No doubt you can repeat this process for anything where the image appears. It's just a case of finding the correct lines to edit ;)
               
               
Logged
I thought I saw a light at the end of the tunnel, but it was just some bastard with a torch bringing me more work.
Chi Verace Durera
___________________________________________________________________
FREE SCRIPTS for webmasters - http://www.liquidfrog.com

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #9 on: September 18, 2004, 03:01:54 pm »

Excellent! Thanks. :)
Logged

rs25.com

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #10 on: November 30, 2004, 12:09:22 am »

Quote
You're welcome there TranzNDance. Further to this, you can also set it so that these images don't appear in the Last Uploads.

Find this line:
Code:
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE  approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");

and replace it with this line:
Code:
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE title <> 'Album graphic' AND approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");

No doubt you can repeat this process for anything where the image appears. It's just a case of finding the correct lines to edit Wink

I tried to do this, but was unable to find that code.  I tried adding the "WHERE title <> 'Album Name' AND" to various suspect queries, also with no results.  This is in the include/functions.inc.php file, right?

Can someone shed some light on what I need to do to make that work?
Logged

rs25.com

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #11 on: November 30, 2004, 12:20:45 am »

AHA!  I finally found it:

Line 612:

                $result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");

Change to:

                $result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE aid <> 3 AND approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");

I used the Album ID instead of the title, but otherwise is the same as above.  :)
Logged

bart5986

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #12 on: January 30, 2005, 05:05:14 am »

You can find the query to grab the random pics in include/functions.inc.php

Code: [Select]
$sql = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' $ALBUM_SET ORDER BY RAND() LIMIT $limit2";
If you want to exclude pics with the title 'Album Thumbnail Only' then change the query accordingly.

Code: [Select]
$sql = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE title <> 'Album Thumbnail Only' AND approved = 'YES' $ALBUM_SET ORDER BY RAND() LIMIT $limit2";

how do you do it to more then 1 album?
Logged

bart5986

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 42
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #13 on: January 31, 2005, 07:21:25 am »

it doesn't work, I changed 'Album Thumbnail Only' to '3D Objects' and nothing changes


what have I done wrong? the code I used was
Code: [Select]
$sql = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE title <> '3D Objects' AND approved = 'YES' $ALBUM_SET ORDER BY RAND() LIMIT $limit2";

Edit: Ok I found out that you can't put text after the name and still block them from random pictures.

Thanks for this mod ;D
Logged

legend_neo

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 54
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #14 on: February 02, 2005, 12:52:51 am »

i dont know if i have done wrong
but instaed of using title, i used "aid" , but nothing happen. Still images from that album was coming on randome files
i did this
Code: [Select]
$sql = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE aid <> 11 AND approved = 'YES' $ALBUM_SET ORDER BY RAND() LIMIT $limit2";               
As suggested by rs25.com  in the topic.

Also , I need to use this for 3 albums, How coud  possibly I do this ????
Logged

Cuddles

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 6
    • ALIAS-Online.de
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #15 on: August 02, 2005, 02:12:08 pm »

Also , I need to use this for 3 albums, How coud  possibly I do this ????
Dito  ???
Logged

Nibbler

  • Guest
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #16 on: August 02, 2005, 02:58:40 pm »

aid <> 11 for one album
aid NOT IN (1,2,3) for multiple albums
Logged

Cuddles

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 6
    • ALIAS-Online.de
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #17 on: August 03, 2005, 02:27:40 am »

aid <> 11 for one album
aid NOT IN (1,2,3) for multiple albums
So I have to replace the 11 in the first case with the Album ID? ???

Which code do I have to use?
This one??
Code: [Select]
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE aid <> 3 AND approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");

EDIT:  ???
« Last Edit: September 04, 2005, 05:41:44 pm by Cuddles »
Logged

arcus

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #18 on: January 19, 2006, 03:30:19 am »

aid <> 11 for one album
aid NOT IN (1,2,3) for multiple albums

i tried using the same method for blocking categories... just adding in (based on the SQL names) :

category NOT IN (1,2,3)

vs. aid.

is there a way to block an entire category? or multiple categories from showing up in the Random section? vs. blocking albums.

thanks.
Logged

Nibbler

  • Guest
Re: Setting the album thumbnails NOT to show in Random Files
« Reply #19 on: January 19, 2006, 05:29:13 pm »

The category number is associated with the containing album, not the pic itself. You'd need to add in a join to the albums table on aid=aid
Logged
Pages: [1] 2   Go Up
 

Page created in 0.027 seconds with 20 queries.