Setting the album thumbnails NOT to show in Random Files Setting the album thumbnails NOT to show in Random Files
 

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]

Main Menu

Setting the album thumbnails NOT to show in Random Files

Started by ComplexRetribution, September 18, 2004, 02:23:51 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ComplexRetribution

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!
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

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.

Nibbler

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

$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.

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

Nibbler

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

Tranz

#4
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! (https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Ftu2.net%2Fforums%2Fimages%2Fsmiles%2Ficon_clap.gif&hash=2e6a95ac0e148480fe34d75a12f7c409fba9c9e4)

ComplexRetribution

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?
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

Ok, no worries I found it. ;)

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

$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:

$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");
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

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. :)

ComplexRetribution

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:
$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:
$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 ;)
               
               
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


rs25.com

QuoteYou'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?

rs25.com

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.  :)

bart5986

Quote from: Nibbler on September 18, 2004, 02:36:45 AM
You can find the query to grab the random pics in include/functions.inc.php

$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.

$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?

bart5986

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 $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

legend_neo

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

$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 ????

Cuddles


Nibbler

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

Cuddles

#17
Quote from: Nibbler on August 02, 2005, 02:58:40 PM
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??
$result = db_query("SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE aid <> 3 AND approved = 'YES' $ALBUM_SET ORDER BY pid DESC $limit");


EDIT:  ???

arcus

Quote from: Nibbler on August 02, 2005, 02:58:40 PM
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.

Nibbler

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