RSS feed for tags in specific albums

WiW

Joined: 2014-07-17
Posts: 4
Posted: Thu, 2014-07-17 09:17

Hi all,

I hope you can help me solving the following issue. I'm using Gallery3.0.9 as a database and would like to obtain a RSS feed to show tagged photos from within a specified album only. How do I get an RSS feed for showing only mountains in America if I have a common tag "mountains" and the albums "Europe" and "America".

RSS feed for album "America": gallery/index.php/rss/feed/gallery/album/9
RSS feed for album "Europe": gallery/index.php/rss/feed/gallery/album/6
RSS feed for tag "mountains": gallery/index.php/rss/feed/tag/tag/2

I hope someone can help me further and many thanks in advance!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2014-07-17 16:45

There is not that functionality.
I would edit the rss_extra module to do what your after.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
WiW

Joined: 2014-07-17
Posts: 4
Posted: Fri, 2014-07-18 07:31

Hi Dave,

Thanks for the quick reply. I installed the rss_extra module and had a look at the code. I have some basic understanding of html and think it is possible within the rss_extra module, but for me this is getting a bit too complicated. Both albums and tags are coded, so a combination of the two should be do-able. Do you know someone who might be able to help out? I searched the forum but can not find relevant posts about this subject, although I expect more people might find it useful.

I know the alternative is to make use of highly specific tags, but they will impair searching the database and clutter up the tag cloud.

Thanks,

Wino

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Sat, 2014-07-19 17:37

I'm going to assume that you really need it in RSS form. (If not, there are easier ways to get the results using search; let me know if that would be useful.)

WiW wrote:
Do you know someone who might be able to help out?

http://galleryproject.org/forum/65

 
WiW

Joined: 2014-07-17
Posts: 4
Posted: Wed, 2014-07-23 12:06

Thanks for your reply.

I am looking for something that can feed into a slideshow (like the MiniSlideshow), and RSS is working well. Since my Gallery database contains a lot of images from different projects with overlapping tags I would like to specify the album AND the tag to only show the relevant images. If this can be easily done by using the search function it would also suffice.

Hope you can help me further,

Wino

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Wed, 2014-07-23 21:00

I suppose there's a way to create that RSS feed, but that's not my thing. If you need to do that, check @floridave's starting point above.

Having said that, RSS is basically a XML feed, right? Gallery could easily create that info on the fly with a query (search feature not required). You'd just check the parent_id and the tag_id to be whatever you want and run the results through a foreach loop.

I'm not sure how to pass that to the slideshow because I'm not sure how the user is picking the inputs, i.e. I don't really understand the use case. How do you know which album and tag is needed for the slideshow? Is the user picking that from somewhere?

If you work out the selections process, etc, I could offer some quick code to generate the xml, assuming you don't already have that.

 
WiW

Joined: 2014-07-17
Posts: 4
Posted: Thu, 2014-07-24 07:11

I ended up using RSS feeds as that was the first that gave the desired results. I'm quite new to programming and have unsuccessfully tried the XML approach. Here is what I have until now:

Gallery root: www.wiwphotography.net/gallery (normal installation into this folder version 3.0.9)
Album ID: 241
Tag ID: 10

I am using the feed to create slideshows on specific subjects on the website, so it's only me who has to do the selecting. I have been trying with the Embed-O-rator at flashyourweb.com, but the resulting code does not function with the minislideshow.

<embed src="http://www.wiwphotography.net/gallery/minislideshow.swf" width="300" height="200"
align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" name="minislide" wmode="transparent"
allowFullscreen="true" allowScriptAccess="always" quality="high"
flashvars="xmlUrl=http://www.wiwphotography.net/gallery/mediaRss.php?mode=search%26g2_itemId=241%26mime=canals"></embed>

Replacing the xmlUrl with http://www.wiwphotography.net/gallery/index.php/rss/feed/gallery/album/241 (or .../rss/feed/tag/tag/10)does however result in a functioning slideshow. My lack of programming knowledge might cause me to overlook something basic, but I can't figure it out yet. Potentially something with the %26mime= or the reference to %26g2_itemId? Is the g2_itemId maybe referring to code that has been changed from gallery2 to gallery3?

Thanks for helping me out on this

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2014-07-24 15:40

There is nothing basic that you are missing. There is not two parameters for the rss module. It has one parameter either a ID or a tag but not both.
You would have to edit the module to add a second parameter to have the functionality you desire. Even the rss_extra module only has one parameter with 2 -switches- ( landscape or portrait). It will not be just a line of code to change but a block to add as well.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
tempg

Joined: 2005-12-17
Posts: 1857
Posted: Fri, 2014-07-25 22:36

Okay, at this point, I'll first say that I don't recommend that you do this (because of your "lack of programming knowledge"; also, there's likely a much better solution, but it may require that you rethink your overall Gallery organizing strategy and the way you're organizing albums and tag hierarchies.

That said, there are several ways to possibly accomplish what you're looking to do. One way is to directly edit the gallery module's gallery_rss file (in the module's "helpers" folder).

Back up everything before you start.

I don't have line numbers here (because I'm using an alternate, no-thrills machine and software right now), but look for the feed function: static function feed.

You could join with the tags tables so that you can add a condition/parameter to "latest" AND the "all_items" queries to check each item in the album (241) to see if it has the appropriate tag (10).

Easier (maybe) would be to completely change the query to return all of the items associated with the relevant tag_id (10) and then return only the items with the applicable parent_id (241).

Either way, the challenge is going to be knowing what tag you want to search for. (Identifying the album is easy, because it will be the album the user is already viewing.) Assuming that you're not going to hardcode the tag that you're looking for, I guess you could give the user a choice (e.g. a dropdown menu or checkboxes or something) and then pass that selection's id# as a php variable, but this could get complicated (and messy) as the number of options increases--and you'd need to check to make sure that the variable is defined before trying to use it.

tempg wrote:
I'm not sure how to pass that to the slideshow because I'm not sure how the user is picking the inputs, i.e. I don't really understand the use case. How do you know which album and tag is needed for the slideshow? Is the user picking that from somewhere?

EDIT: I just re-read @floridave's comment. If you're going to do this, and if it's possible to edit the rss_extras module instead of Gallery's core, that's MUCH better. I haven't looked at the rss_extra module's code yet, but I'd suppose that it'd be a similar edit to what I indicate above (at least the concept should be similar) so you can decide if you want to put in the work it might require.