xml.php creation of Media RSS feed from Gallery2 albums
natec
Joined: 2007-06-21
Posts: 13 |
Posted: Wed, 2007-07-11 22:51 |
Hi All! I've spent the last two days trying to get my gallery2 to output Media RSS feeds that work with PicLens (http://www.piclens.com/enable), and I think only one thing stands between me and a working implementation. I've been modifying the xml.php file that is part of the XML mini slideshow located at http://www.flashyourweb.com/dokuwiki/doku.php?id=xmlmini, and with my limited knowledge I've been able to get it to output the XML file needed, except the <link> parameter in each <item> is formed with the form /gallery2/main.php?g2_itemId=###, while the links assigned to the thumbnails on my album pages have the rewritten format of /gallery2/v/albumpath/filename.jpg.html I'm including my modified xml.php file at the bottom of this message with the hopes that someone can suggest a clean way to get the photo page links into the <link> parameter. I think the part that I need to figure out how to change lies in the function getLink() or something with the urlGenerator. If anyone else wants to try this, in your local theme.tpl file, beneath this line {if $theme.pageType == 'album' || $theme.pageType == 'photo'} <meta name="keywords" content="{$theme.item.keywords}" /> <meta name="description" content="{$theme.item.description|markup:strip}" /> {/if} add this line {if $theme.pageType == 'album'} <link rel="alternate" type="application/rss+xml" title="MediaRSS:{$theme.item.title}" href="/gallery2/xml.php?g2_itemId={$theme.item.id}" /> {/if} which will declare the RSS feed on each album page. Thanks!! |
|
Posts: 13
Got it working, thanks to help from suprsidr! the modified xml.php file code is attached. It works great in Safari with the PicLens plugin, and I haven't tested it yet in FireFox on windows with the plugin, but I have no reason to believe it wouldn't work.
-Nate
Posts: 13
Ok, the above works for PicLens in Safari, but not in the FireFox plugin on WinXP. The developers of PicLens are looking into it and suggested that they may have a bug that they need to fix in PicLens Firefox. I'll post back when i hear what they find out.
-Nate
Posts: 4
So here is my insanely lame question. I can not find where to put this file. Can someone tell me the path?
Thanks!
Posts: 166
If you look at natec's original post, you'll see the following:
href="/gallery2/xml.php?g2_itemId={$theme.item.id}"
So if you use that href as-is, it would appear that you should be placing xml.php in the root of your gallery2 installation. If you put it elsewhere, you'd need to change that href accordingly.
HTH,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 13
Thanks for answering, Conor... I typed up a reply yesterday and hit preview without the final submit. You are correct- I think you can put the file elsewhere, but I've put it at my gallery2 root, and it has worked for me.
Still no update on a working version of PicLens for Firefox Windows working with this RSS feed. At first the developers seemed very willing to investigate, but I haven't heard anything back from them narrowing the problem to their code, firefox's RSS parsing, or a problem with the RSS feeds that our xml.php file is generating. They suggested I try out their new "PicLens Publisher" software for windows (doesn't work on my Mac) that will take a bunch of images and automatically create all of the html and rss files needed for a gallery. I pointed out that it sounds like a great solution for the iLife crowd, but doesn't meet the needs of those using Gallery2, since most people use it for the ease of administration of hundreds and thousands of photos, security features of users and groups, and other powerful features like custom themes, shopping/selling/etc.
If you'd like to get in touch with the PicLens developers yourself, to inquire about getting PicLens Firefox on Windows to work with our solution (or at least find out where the problem is), you can shoot them an email at [url]mailto:feedback@piclens.com[/url].
-Nate
Posts: 166
Nate,
One thing I notice in the XML from your xml.php (although it may not be significant), is that when I run it on my gallery, the URLs for the media:content and media:thumbnail tags are fully qualified. e.g. on my gallery, one example is http://gallery.ildica.com/d/8289-2/IMG_1255.jpg?g2_GALLERY... whereas the img src generated on my gallery album page is simply /d/8289-2/IMG_1255.jpg
I'm not sure how PicLens does it's matching, but it could be the differences are significant?
I haven't looked into the Gallery code enough (or understand enough PHP anyway) to know if there's an easier way to get the shortened URL so that it matches.
Thoughts?
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 13
Hi Conor,
I might not be understanding what you are asking... did the xml.php file not work with PicLens in Safari on your website?
On my site, PicLens uses the MediaRSS media:content and media:thumbnail tags to get the full size images, and does the matching with the thumbnail links on the album pages, which link to the gallery page showing the full-size image.
-Nate
Posts: 166
Hi Nate,
Sorry, haven't tried Safari against my site. If I get time, I might install it on a virtual machine and see if it flies.
I was just looking at the example feeds on the PicLens site and comparing them to the feed from my site and the thumbnail links on the album pages. The examples on the PicLens site match exactly (e.g. the media:content tag matches exactly the thumbnail url on the album page), whereas the ones generated by the xml.php on my site don't. For a start they have the GALLERYSID appended.
I was simply wondering if this might be significant in how PicLens does it's matching.
Cheers,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 13
Hi Conor,
Ahh... I understand now. Do you, by chance have URL rewrite turned on in Gallery? I do, so the XML is generating objects that look like this:
The link URL matches exactly what the thumbnail link URL is for a photo on my Album pages. The original xml.php file I modified was giving me links with the GALLERYSID stuff, which didn't work because I was using the URLrewrite feature (and it may depend on how your theme is configured to create links? I'm using Carbon).
-Nate
Posts: 166
Hey there,
Yeah, got URLRewrite on.
Here's one of the items from my xml.php (which I've tried tweaking a bit already):
And here's the corresponding bit from my album page:
What I was comparing it with was the sample XML from the Firefox section on the PicLens site (http://www.piclens.com/firefox/photos.xml):
which has relative urls.
Soooo, I've still got problems with the GALLERYSID, etc.
I haven't tried contacting PicLens directly, but I will do so.
Thanks for the conversation, it would be really nice to get this working. ;-)
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 13
I'm attaching my version of my xml.php that I'm currently using to this message. I see that all of the links in my MediaRSS feed are absolute. Can you check my xml.php against your version to make sure we are using the same code to get the links?
I really don't understand why PicLens for Safari works fine on my site and the MediaRSS feeds that I'm generating, while the PicLens for Firefox Windows doesn't. It makes me suspect a bug in the PicLens code, or (since the difference is the browser) a problem with the validity of the MediaRSS feed, where Firefox is pickier.
-Nate
Posts: 7
Is there any update on this? I just discovered PicLens and would love to implement it on my Gallery2 site, but unfortunately 95% of the users are on Windows.
Posts: 7
Also, are the instructions above current? I don't find a line in the theme.tpl file that matches the line above.
Posts: 166
Since I had the above conversation with Nate, I've also been in touch with the PicLens support guys.
Sadly, while they were interested in beta feedback on the PicLens Publisher tool they're currently developing, they don't seem at all interested in helping me understand why I can't get PicLens going against my Gallery using Firefox.
In terms of where to put the entry in your theme.tpl, just find the <head> tag in your theme.tpl and put it somewhere appropriate close under that. I assume you've made a copy of your theme.tpl file in a "local" subfolder.
If you get it going, I'd love to hear about it, but I've put it on the back burner myself for now.
Cheers,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 13
Yeah, I think there's still no luck with the windows Firefox users. I never really got the PicLens guys to understand that their PicLens publisher software might be great for people to put up a simple web gallery, but that Gallery2 offered a lot more functionality for those that have lots of images or users, or need shopping-cart type features... two different markets that would both benefit from having a working PicLens!
-Nate
Posts: 7
I may have some good news for you guys, it is working on my site.
I included the following line:
After the following lines in the theme.tpl file:
I also had to edit the xml.php file as my folder is called photos and not gallery2. That's all I did though and it works great. I wonder if PicLens has corrected the problem?
Posts: 166
Interesting!
With Firefox?
Is your Gallery publicly available? Would you be able to share the URL with us so that we can have a peek?
Cheers,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 7
Okay, so check this out. It functions on my work computer, but NOT on my home computer!!
Gah! Both are windows, both are on the same version of Firefox. I'm going to play around with it to see what is different. I will probably start by installing all the plug-ins on my home computer that I have at work. Then I will try removing them until I find the magic plug-in.
My photo site is not publicly available, but since I am all about sharing, I'll make one album publicly available for a day or two: http://www.theharwoodfamily.net/photos/main.php?g2_itemId=379
I'll let you know when I get it working on my home PC.
Posts: 7
Okay, I don't understand this, but here's the deal.
It just so happens that I was trying out a few new plug-ins today. One of them was PicLens. The other was Yoono. So, I installed Yoono on my home PC and now PicLens is working. Go figure.
https://addons.mozilla.org/en-US/firefox/addon/1833
Posts: 7
Disregard the last. I uninstalled Yoono and it is still working fine. I don't know why it wasn't working at first.
Posts: 166
Tried your URL thanks.
I get the little PicLens overlay on each thumbnail, but clicking on it doesn't do anything (apart from make the little circular throbber rotate at the bottom right of the thumbnail).
Installing Yoono didn't make any difference either.
PicLens still works fine if I view any Flickr album.
Oh well.
Cheers,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 166
Which version of Firefox are you using? I'm on 2.0.0.7, with Piclens 1.5.11.
Cheers,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 7
That's really odd. I will say that my site is slower than Flickr since the images are typically much larger, but if I get the Piclens icon on the image, it ALWAYS works. The times when it was flaking out, I wasn't getting the Piclens icon on the image. You might try waiting a bit to see if the image eventually comes up. I'm running my webserver out of my basement on a standard DSL line, so it's not real zippy.
I'm using FireFox version 2.0.0.7 and PicLens 1.5.11.
Posts: 8339
It worked for me (mostly) on the harwoodfamily site. Loaded very slow. about 20 seconds for initial view.
I'm in the process of changing all of my flash apps over to Media RSS, so I will have a release of a true Media RSS xml.php probably later tonight which supports keyword albums, tag albums, all dynamic albums...
The new rss module for G2 has Media RSS setting, but it does not include most of the necessary tags.
-s
FlashYourWeb and Your Gallery
Posts: 8339
Here is the new feed generator.
fixed url-rewrite for natec
included all necessary media rss content.
will generate all types of dynamic album feeds(tags, keywords, random, updates and popular)
remember to edit line 30 if necessary(formerly 5)
-s
FlashYourWeb and Your Gallery
Posts: 13
thanks suprsidr! I just swapped in your new xml.php file for my old modified one, and PicLens worked in Safari just as it had before without any changes needed! I don't have any dynamic albums in my website, so I haven't tested that feature, nor have I tested Windows Firefox PicLens yet.
-natec
Posts: 166
Yeah, thanks Suprsidr.
I have downloaded it and will try it out later; I don't have time today.
PicLens on FF was working for me (slowly) on the Harwood Family site, so hopefully I'm getting close to getting things going on mine. ;-)
More as I have it...
Cheers,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 166
Hi,
I finally got round to trying your latest mediaRSS posted above, Suprsidr.
The script seems to be outputting nothing.
I changed the embedding URIs on line 30 as appropriate, and it seems to produce no output (e.g. http://gallery.ildica.com/mediaRss.php?g2_itemID=9206)
Any further thoughts before I sadly give up trying to get PicLens working in FF?
Many thanks,
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 8339
The version included with this player is more refined if you care to give it a try.
I'm going to finish adding mediaRSS to the G2 RSS module this week, will let you know when its been reviewed and it available.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 166
I've tried this new version with the same lack of success on my gallery.
It seems to be failing somewhere in the getAlbumList method. It just silently bails out, so the output from the php script is
<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
I put a few echos in to see how far it got, and it gets as far as line 304 or thereabouts, and then nothing further:
foreach ($Albums as $Albums){
It might be significant, but I'm still runing G2.1, not G2.2:
Gallery version = 2.1.2 core 1.1.0.2
PHP version = 5.2.2 cgi-fcgi
Webserver = Apache/1.3.37 (Unix) mod_psoft_traffic/0.1 Vortech_PHP/0.1.0-p0 FrontPage/5.0.2.2623 mod_throttle/3.1.2 mod_ssl/2.8.28 OpenSSL/0.9.7e-p1
Database = mysql 4.0.26, lock.system=flock
Toolkits = Exif, Gd, NetPBM, ImageMagick
Acceleration = partial/21600, partial/900
Operating system = FreeBSD unix11.hsphere.cc 6.1-RELEASE-p12 FreeBSD 6.1-RELEASE-p12 #0: Thu Feb 1 16:50:12 EST 2007
:/usr/obj/usr/src/sys/WEB6 i386
Default theme = PGtheme
Locale = en_GB
Browser = Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; InfoPath.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 8339
you can safely comment out the get call to the albumlist
$xml .= getAlbumList ($g2_itemId);
the E2 player and xml_all.php are the only places its necessary.
I've had problems with this function before, seems I still need to rework it ;)
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 166
Thanks for looking into it further.
Better, in that I at least get something now. However, it's not what we were hoping for. ;-)
Conor
Christchurch, NZ
GLoSS: Gallery2 Local Screen Saver & Desktop Changer
Posts: 8339
I believe this change is post 2.1, gallery now requires the itemtype to be passed
list ($ret, $entity) = GalleryCoreApi::loadEntitiesById( $id, 'GalleryItem' );
try it without the type:
list ($ret, $entity) = GalleryCoreApi::loadEntitiesById( $id);
there may be more instances that also need to be changed.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 1
I got it working on Win XP and FireFox 2.0.0.9 with PicLens 1.5.15, using the first media rss posted by natec on Gallery version 2.2.1 core 1.2.0.1. Even the URL-rewriting works well!
Using the media rss posted by supersidr, I got problems with the GALLERYSID.
Posts: 35
Not sure what I am doing wrong here. I have tried just about everything I have read.
I just want to be able to spit out a media content rss feed for any paticular album in my gallery.
I keep getting errors about invalid top level document.
Any idea of how this can be done or what I might be doing wrong?
Thanks
Banta
Posts: 8339
sample url?
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 35
Sent you a PM.
And might I say that E2 is far from the bouncing Logo player I had before. Extremely well done!
Thank You!!!
Posts: 35
This was user error. The feed is working fine.
Just to note, it didn't seem to work in IE6. But returns the results fine in IE7
Thanks
Banta
Posts: 9
any developments on this?
I am trying to get this working but no joy so far in safari or ff
Posts: 13
Perhaps someone can help if they know what version of Gallery/PicLens/Safari/FF you're using. It seems like getting this working is rather hit/miss between different versions, and an update in any of the components can cause another to break. I'm still using the xml.php posted in this thread on 10/17, and it still works for me in non-3.0 Safari. Haven't tried in Firefox recently.
Posts: 9
I think I have the standard slide show working does this enable the immersive slides? (the new 3d wall effect)
Thanks
Lee
Posts: 1
First of all I want to thank everybody on this thread Finally I got this working with Windows XP and Firefox
After trying almost every combo in these threads the thing that finally worked for me was Natec's first xml.php file and Malandro95's edit of the theme.tpl.
theme.tpl (malandro95's way)
find the following:
then add the following:
(in my case I removed /gallery2/)
xml.php (from natec's first post)
I had to remove the /gallery2/ reference since I have every gallery in it's own subdomain.
(line 5)
became =>
multi-site install:
Since I'm using multisite install I have the xml.php in my base gallery2 directory (/usr/share/gallery2/xml.php).
In each gallery I created a seperate xml.php which refers to the base install.
xml.php (in every gallery)
Posts: 9
I have tried both the original xml and the mediaRss file,
both worked fine for me in terms of the normal piclens
slide show but neither seem to support the new 3d wall.
The xml.php file seems closer to it but I dont think either will
support the 3d wall as the guid has to match the image
URL from your feed to the attribution tag in your HTML page,
i.e. <a href="/images/anyimage.jpg"></a>
any one know what I am on about or can help?
Posts: 9
Ok I am getting closer, I have the 3d wall working when I click the firefox plugin icon in the toolbar but I can not get the little play icon to appear on the actual images.
I think this is because the output from the rss converts & signes to & which does not relate back to the actual gallery image href.
Does anyone know how in xml.php I can stop this extra & appearing?
====================
Ok I bodged the xml.php file to do what I needed if you have the piclens firefox plugin installed
go to http://www.0-21.co.uk/index.php/Gallery/?g2_itemId=14
and click teh lpay icon that appears on the thumbnail when you mouseover.
these are old pics and are not set to the right size for best impact
Posts: 1
I think I found a possible problem with the xml.php file provided by natec.
On my Linux machine, I had to remove all unreadable symbols from the end of each string. It made PicLens to work at once.
Check the working site http://photo.dvinsker.lv/main.php?g2_itemId=755
Posts: 13
Hi Midbar-
Can you attach a text file with your changes? I have seen weird symbols in my automatically generated RSS feed, and haven't investigated to find out if it's because there was a mismatch between the listed text-encoding type, and the way my webserver was actually serving the file. Does that have something to do with it?
-natec
Posts: 11
Hi everson
I checked out your gallery and the 3D Piclens slideshow seems to work perfectly !
Could you give us your method ?
Thanck You
Posts: 9
Hi Totoro, Yes it does work but only because I have altered the xml.php file to get rid of my issue.
I will zip up my file and post a download link but it's a hack, (it really should work as is)
Natec
Do you think my problems could be related to the fact that my gallery is embedded in joomla?
my xml output is
note the & in the link and guid
should be
I ended up hard coding the link and guid to avoid this extra & but is I can figure out what is putting it there the xml.php file provided by natec would work 'out the box'
Any help would be appreciated!
Posts: 9
Here is my file, there are notes in the file, but like I say, its a hack/bodge
NateC file really should work for everyone (as it has for midbar)
My issues may be purely related to my joomla embedded gallery using sef urls
Cheers
Lee
Posts: 71
Ok, I have used the orignal natec xml.php file and the changes that was made into the theme.tpl
Not working here for me.
----
Gallery version = 2.2.3 core 1.2.0.5
PHP version = 4.4.4 cgi
Webserver = Apache/1.3.37 (Unix) mod_auth_passthrough/1.8 mod_log_bytes/1.2 mod_bwlimited/1.4 FrontPage/5.0.2.2635.SR1.2 mod_ssl/2.8.28 OpenSSL/0.9.7a PHP-CGI/0.1b
Database = mysqlt