Using tags to select albums and photos

Hi all

so in the previous version of Zenphotos, tags was a column of the albums and images tables. I have a random picture displayed on my gallery home page, that works well. However, I soon came to realize that there were albums full of photos I didn't want to use as the random photos (the less artsy, more common photos).

So I tagged those albums with 'no.random'. This is a good example: http://www.frenchguys.com/gallery/Sports/FollyCoveRB/

I then modified the custom code for the random image (as well as my SlideShowPro director XML generator with the 'show.in.flash' tag - http://www.frenchguys.com/gallery/page/2?view=flash) to use the following query:

`SELECT``id`,`title`,`desc`,`folder`,`thumb` FROM ".prefix('albums')."WHERE `tags` LIKE \"%show.in.flash%\" ORDER BY `parentid` ,`albums`.`sort_order` ASC

However, in the most recent version of ZP, the tags column has disappeared for reasons I fully understand (much cleaner, better for searches, better to delete a tag across the gallery, ...). Now there is an obj_to_tag table to associate an image or album (I am guessing 'id' is unique across those two tables ?) to a tag, tags which are stored in the tags table. Great.

Can anyone help modify my existing query to incorporate that change ? I am not great at SQL ?

Thanks in advance

Comments

  • Maybe it would be easier for you to stick your `no.random` and `show.in.flash` id in the custom data field. Then you can just change your SQL to use that field instead of the tags field.
  • Hmmm, interesting. I'll check to see if there are a small enough number of albums so that I can do that.
Sign In or Register to comment.