Reading images with SmugMug RSS

Flight643Flight643 Registered Users Posts: 4 Beginner grinner
Hello!

I've created a custom design that I've built out outside of SmugMug. The design is using some jQuery to create a custom gallery viewer. As I began implementing my new design into my SmugMug account I realized it was a little tricky to do because I need control over how to export my thumbnail data in order for my jQuery photo viewer to work the way I've programmed it to.

For example, I'd ideally be able to tell Smugmug to wrap each gallery's photo thumbnails inside of their own line item tag.. ie:

[HTML]
<ul id="gallery_thumbnails">
<li><a href="link/to/image/"><img src="path/to/file" /></a></li>
<li><a href="link/to/image/"><img src="path/to/file" /></a></li>
...
[/HTML]Since this doesn't seem like something I can do inside of SmugMug's interface I decided I could just host the site outside of SmugMug and still use SmugMug as the back end. So now I'm looking into using SmugMug's RSS feeds with PHP to pull and display the image data how I want it.

For anyone who is curious.. This is the PHP I'm using to pull my smugmug images:

[PHP]
$rss = new SimpleXmlElement('path_to_your_rss_feed_here');

echo "<ul id='gallery_thumbnails'>";

foreach($rss->channel->item as $item) {
// The 'description' value by default returns two paragraph tags and a link of the username's website.
// Use strip_tags to keep only the image
// Then use PHP's subtring to get rid of your floating username.
echo "<li>" . substr(strip_tags($item->description, '<img>'), 7) . "</li>";
}
echo "</ul>";
[/PHP]I had to axe some unwanted information but it works. Afterwards I also use jQuery to remove the 1px border added by default...

[HTML]
$(document).ready(function() {
$('ul#gallery_thumbnails img').removeAttr('style');
});
[/HTML]It's a little sloppy and the draw back is that I now need to pay for external hosting as well as SmugMug services, but hey it works and allows me to get my images in a nice little unordered list so that it's compatible with my customized jQuery slideshow.

My question is: Is this one of the more feasible ways of going about it? Or is there a way I can control SmugMug data output (i.e. display each thumbnail within a simple unordered list and anchor tags that I bind controllers to via jQuery) from within my SmugMug account and eliminate the need for having a hosting account that is separate of my SmugMug account?

Thanks!

Comments

  • jasonhendriksjasonhendriks Registered Users Posts: 1 Beginner grinner
    edited April 11, 2011
    Flight643 wrote: »
    Hello!

    My question is: Is this one of the more feasible ways of going about it? Or is there a way I can control SmugMug data output (i.e. display each thumbnail within a simple unordered list and anchor tags that I bind controllers to via jQuery) from within my SmugMug account and eliminate the need for having a hosting account that is separate of my SmugMug account?

    Thanks!

    I thought it was possible to create static pages with a SmugMug account. Then you could do the same thing you did in PHP with Javascript.
Sign In or Register to comment.