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 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.
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";
You could do a similar thing using pwidth to block the panoramic pics.
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://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Ftu2.net%2Fforums%2Fimages%2Fsmiles%2Ficon_clap.gif&hash=2e6a95ac0e148480fe34d75a12f7c409fba9c9e4)
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?
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");
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. :)
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 ;)
Excellent! Thanks. :)
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?
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. :)
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?
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
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 ????
Quote from: legend_neo on February 02, 2005, 12:52:51 AM
Also , I need to use this for 3 albums, How coud possibly I do this ????
Dito ???
aid <> 11 for one album
aid NOT IN (1,2,3) for multiple albums
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: ???
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.
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
Quote from: 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
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?