Recent Galleries listing
McDonDem
Registered Users Posts: 11 Big grins
I want to show my seven most recent galleries on my homepage automatically with the first being the medium size and the other six being the tiny size. I know they can be brought up through rss but I don't know javascript well enough to implement it myself. If anyone could help me, it would be a great benefit.
davenortonpics.smugmug.com
davenortonpics.smugmug.com
0
Comments
Ok, it can be done. I borrowed and tweaked an AJAX Feed Reader/Parser from here and plopped the output into my Bio box.
Check it out: http://gladlee.smugmug.com/
It's super-ugly, as I didn't bother to try to format the output into SmugMug's miniboxes.
You can check my Javascript ugliness by using Firebug. I've hardcoded the rssurl to be my Recent Galleries feed for only the last 8 galleries. (A bug in the RSS feeds includes private, and thus not-visible galleries in the count.)
But anyways, it's a start. Do any actual coders (instead of a hack like me) want to pick up the ball and run with it?
Here's what I think needs to be done:
- Check to make sure you're on the home page before running getRSS this.
- Can miniboxes go in the Bio box? If so, format the output so that it looks like a regular Recent Galleries page, including Title, Description, and Updated.
- Maybe use some other box, because a) people actually want to use the Bio box, b) it screws up the feed. Featured won't work because it doesn't appear unless there's already a gallery featured. :P
- Add "Recent Galleries" boxTitle
- Remove RSS Channel Title and Link.
- Remove RSS Copyright Info and PubDate
Extra-credit:
- Implement multi-page "recent galleries" functionality so that you could page forward/backwards 8 galleries at a time. And because it's AJAX, it wouldn't even need to refresh, right? Man, that'd be sweet.
http://www.xml.com/pub/a/2006/09/13/rss-and-ajax-a-simple-news-reader.html
I may actually sit down and go through it, instead of being lazy and just trying to hack it.
I got it to work. I got on the computer and search for info on javascript and used the rss-ajax news reader that darryl pointed out to me and modified it to give me just the information I needed (gallery number and gallery title) so I could display my recent galleries in the different sizes I wanted.
Thanks for the help
Well, it's publicly available on your site. But I was thinking of tweaking it and posting something here. Sweet -- time to do some more hacking. ;-}
did you realise that you can just add &Size=xxx to the feed url to get a different size image ?
eg. &Size=Large
Cheers,
David
SmugMug API Developer
My Photos
Yes I did, I just wanted to grab the feed once to pull a random "Medium" picture of my most recent gallery and pull random "Tiny" pictures for the other six next recent galleries as well as the titles of those those galleries.
go ahead and use it. I think that this rss reader could be used in many good ways for customization.
http://gladlee.smugmug.com/
Well, almost. Now I need a better place to put the Recent Galleries listing instead of the Bio Box. On IE, I get two columns. But in Firefox, it's just the one.
I suppose I could use Featured Galleries, but I need some help replacing everything in there with my generated miniboxes. Guess I'll look at devbobo's "recent photos" code, although I think that uses the Yahoo stuff which makes my head spin when I look at it.
[Also, the date format is in RSS format, not standard SmugMug format. I may get around to writing a regexp to fix that. Also, no gallery descriptions. Gah -- they're not in the feed. :-{]
But now I'm trying to get fancy and use the Yahoo UI stuff to try and add my recent galleries in the Featured Galleries box. (And ideally I'd like to make the one featured gallery that's required to make the box show up at all go away.)
This isn't working:
Devbobo, think you could give me a hint?
I was wondering why you don't modify your script and page a bit to put your recent galleries in a div tag at the bottom of your header section. This would put it above your featured galleries and categories boxes, but you would also have more control over it.
I want to try and use SmugMug's styles because I want this solution to be portable. I'm actually planning to ultimately use this on a different SmugMug site, and I want to be able to just use the code w/o having to modify headers.
Additionally, if I use SmugMug's styles, then any changes to themes and stuff will automatically be applied to the recent galleries "box" as well. If only there was a way to have an arbitrary "box" in there, instead of me trying to "clean out" one of the existing boxes.
It is a TOTAL HACK, but it works...
http://gladlee.smugmug.com/
Reasons this is a horrible hack:
- You lose your Friends & Family box because I am replacing its contents with Recent Galleries. However because it takes a while to parse the RSS feed, people will still see that box temporarily.
- I couldn't figure out how to retain the "Move Up / Move Down" thing for home page configuration, so you'll have to move other stuff around the new Recent Galleries box to position it.
- JavaScript is still broken because I can't #!@*$(& figure out why it thinks RSS.items has no properties
Other nitpicks:
- Date format does not match regular SmugMug dates. This should be somewhat fixable.
- No gallery descriptions -- they are not in the feed, so I would have to make yet another call to obtain them. Ugh.
- RSS feed for recent galleries still returns an inaccurate number of items when specifying ImageCount because it counts, but does not return Private Galleries. Workaround requires downloading a "buffer" of extra galleries, which slows things down.
But anyways, it works. Please look at my JavaScript and laugh/cry, then give me suggestions on how to fix it. :-}
Now I'm plopping the Recent Galleries into the Featured Galleries box. So you lose that box. But it does load a lot more cleanly, I think. However, much like the [thread=26968]Recent Photo Gallery Timeline Hack[/thread], I haven't figured out how to remove the token Featured Gallery that I need to have so that the enclosing box shows up at all.
Fixed -- I'm trying to be good and only modify the elements I need.
Fixed -- This was because I wasn't checking to see if (grr), the RSS feed had short-changed me some galleries because of its brokenness w/ Private Galleries.
Date format fixed. Still working on military time (ugh). Also, found out a dirty little secret: Timestamps of album updates (at least in RSS) may actually be PST or PDT, but SmugMug just slaps PST on all of them. Oh, that album you uploaded at 8PM in the summer? It's going to be timestamped 7PM.
No fix.
Also still broken, and as it turned out, was causing other problems.
Anyways though, I'm a little happier with it, despite it still being a nasty hack.
Anywho, not that anybody cares, but here's of an example of the script in action:
http://darryl.smugmug.com/ (my feeble attempt at concert photography)
Also: http://nzsmaps.com (amazing extreme sport/ultimate disc photography and killer customization)
Here is my whole stinking ugly mess:
{edits - fixed IE incompatibility; need to actually *call* getRSS; added tiny bit of CSS to make grouping tighter, since we don't have description anyways; added body tag to call function; didn't *really* want multiline searching; fixed 0:00 (midnight) hours; CNAME/custom domain fix; added info on loading animations, replacing different sections}
Header Javascript section:
CSS section:
Body tag section:
IMPORTANT: YOU MUST HAVE A FEATURED GALLERY. I forgot this, installed it on another account, and was wondering why my Bio box kept disappearing on load.
What this script does is replace that your Featured galleries with your Recent Galleries. This means there must be at least one featured gallery to replace. Additionally, because this is a *MASSIVE HACK*, it can sometimes take a while to read an RSS feed via JavaScript, parse it and format it for display.
So you need to create an Unlisted (hidden) gallery with a "Loading..." graphic. Sometimes it can take a second or three for my script to grab your RSS feed, parse it, format it, and display it in the browser. You *used* to be able to use a nice animated gif, like here, but a recent SmugMug "fix" forces all thumbnails to be uniform, even if the original image is *smaller* than the standard thumbnail size. Argh. I'm looking into a workaround.
Finally, be sure that there aren't any other featured galleries, because those will show up (and then get replaced by the script).
NOTES:
Replacing a different section instead of Featured Galleries
Oh, a number of people have asked how to replace the Recent Photos block (instead of Featured Galleries). Here's the relevant lines you'll need to change:
Disclaimer/pleas for help
Please note that I am a total hack, so this code is not optimized, and doubtless has a lot of excess stuff in it. I welcome any suggestions on how to clean it up, as well as any tips/code on how to get the Gallery Descriptions in there.
Is there any way to have this appear on another page, not my homepage? I would love to have a link in my banner to my "Recent Updates" or something and have it go to a dedicated page for this.
Thanks
http://dgrin.smugmug.com/gallery/2160039
just have to change the galleries to recent, etc.
The only problem remaining is that I want the galleries/categories box to appear when I'm logged in on my homepage only and not my galleries (2nd homepage) page. Right now it doesn't appear on either when I'm logged out (which is correect), but it also does appear on both when I'm logged in. Clearly not a huge deal, but I can't figure out how to get rid of it on the galleries page.
Hi; I just tried to get this going but wasn't having much luck (I'll keep trying) but it seemed like a newer solution has come up or something? I checked out gladlee.smugmug.com and I don't see all this javascript in the page source?
Nevermind, I'm dumb, I see how it all works now; the .js is on another page, and I wasn't doing everything right. And I see now that the cool thing to do is have a 'hidden' gallery called "Loading..." that makes it look like it's loading. Smart!
Boy though, wouldn't it be great if Smugmug simply supported a "Recent Albums" panel for the front page? Because hacking it this way is kind of slow.
http://paulspot.smugmug.com
Your "hack" rocks! I really appreciate it. And ignore my "stumped" question. It had not occurrd to me that my loading gallery IS one of myrecent galleries.
Again, it's a sad side-effect of this being a hack, when it should be (IMHO) implemented into the core features of SmugMug.
--Darryl
Yeah, it is a bit odd that there is really no facility for recent photos or galleries. The timeline thing isn't really workable because it's in the wrong order. I know smugmug needs to differentiate themselves from flickr but recent photo streams is kind of a commodity and would surely be appreciated. But until then, thank goodness for folks like you
http://jt.smugmug.com/
(Again, sorry JT, but since you are one of the few people I know that continue to show all your galleries sorted by most recent on top, you serve as a great example. :-)