forum.coppermine-gallery.net

Support => Older/other versions => cpg1.3.x Support => Topic started by: ComplexRetribution on September 18, 2004, 02:23:51 am

Title: Setting the album thumbnails NOT to show in Random Files
Post by: ComplexRetribution 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!
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Tranz 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.
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Nibbler 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";
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Nibbler on September 18, 2004, 02:39:04 am
You could do a similar thing using pwidth to block the panoramic pics.
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Tranz on September 18, 2004, 03:39:15 am
In conjunction with the solution in the other thread (http://forum.coppermine-gallery.net/index.php?topic=10085.msg45371#msg45371), I can at last have stitched photos in my gallery without mucking up my layout. Thank you so much, Nibbler! (https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Ftu2.net%2Fforums%2Fimages%2Fsmiles%2Ficon_clap.gif&hash=2e6a95ac0e148480fe34d75a12f7c409fba9c9e4)
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: ComplexRetribution 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?
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: ComplexRetribution 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");
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Tranz 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. :)
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: ComplexRetribution 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 ;)
               
               
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Tranz on September 18, 2004, 03:01:54 pm
Excellent! Thanks. :)
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: rs25.com 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?
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: rs25.com 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.  :)
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: bart5986 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?
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: bart5986 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
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: legend_neo 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 ????
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Cuddles on August 02, 2005, 02:12:08 pm
Also , I need to use this for 3 albums, How coud  possibly I do this ????
Dito  ???
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Nibbler on August 02, 2005, 02:58:40 pm
aid <> 11 for one album
aid NOT IN (1,2,3) for multiple albums
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Cuddles 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:  ???
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: arcus 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.
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: Nibbler 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
Title: Re: Setting the album thumbnails NOT to show in Random Files
Post by: arcus on January 20, 2006, 10:51:12 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

hmmm... the categories are not contained within albums though.

but looking closer at the URLs... it doesn't seem to maintain a category/album structure... but that instead the categories are their own units that are independant of albums... yet albums still appear to be contained within... even though logically they are not. so i will have to block using album numbers? that will be difficult to maintain.

is there a way to block things from "Random" based on file type instead? like only show image files with a certain suffix? and NOT show like .mp3 .mov .ppt etc etc?