[ PHALKUNZ'S BLOG ]

I've moved to http://phalkunz.com. You'll be redirect to my new blog soon.

Sunday, May 27, 2007

Recent Flickr Photos with Javascript

I've just written a javascript code to extract my recent photos' thumbnails from flickr. You can see the demo on the sidebar of this blog. Yeah finally I made it :) You're welcome to download the code to use/modify. To get it working in your blog, replace YOUR-KEY in the first line of code with your Google API key, url in Feed with with your flickr feed, and create a new html/javascript widget with the code. That's set!

7 comments:

Ekleipsis said...

thank you for your great javascript code...i have already istall it on my blog, but i changed a little bit because i would not like the images to have the link to flickr but to only to show the latest pictures....!

You can see it on this url:
http://nuestrathalia.blogspot.com/

Thank you again!

p+k said...

Yep, you're welcome to change it anyway you like. Glad that you find it useful. Cheerz.

Mike said...
This comment has been removed by the author.
Mike said...

Hey,
The script works great. Is there anyway to have it process the thumbnails larger? I tried setting the width in the formatThumb function and in css. The dimensions were correct but the image was pixelated.

p+k said...

@mike: on line 45 of the code (st = st.replace("_m.","_s.");), you can remove that line, so the size will be medium. Or you can change _s to either _t or _b. Read more about the size suffix here http://flickr.com/services/api/misc.urls.html

if you still have more questions, don't hesitate to write me more. Please go to http://phalkunz.com/blog. Cheers.

m2ew said...

Hey,
Thanks got the size working now.
1 more question.. Is there any way to tell this to randomize photo? Tried adding Math.random(); as part of the process in the 'i=' loop and tried it as part of the function getThumbUrl(st), but no luck.

p+k said...

@m2ew: you can try this:
- first you should increase the number totalNumOfPics so that you'll have more photos to select from
- the first 2 line in the loop
var ran = Math.round(Math.random() * totalNumOfPics);
var entry = result.feed.entries[ran];

I haven't tested it out yet but it should work fine.
If you happen to use wordpress, you can try my new widget http://phalkunz.com/2008/01/27/resizeable-recent-flickr-photos-widget/