JeremiahTolbert.com: SF Writer Web Designer Photographer

Making FlickrRSS Work for Me

Filed Under: Javascript, Top Post

My goal with this new site is to not only to design a very clean, beautiful site, but to also showcase some of the nice effects that are possible with javascript libraries like jQuery (and teach myself how to effectively use them in the process). Last night, I worked for over 6 hours simply getting one small section of the front page to work the way that I want it to. My rule for myself was simple: I would accept no compromise from the design that I drew in Photoshop–unless IE 6 and its crappy rendering forced me to, which it did on the horizontal tab navigation. Bad browser! BAD! No biscuit.

So, if it’s still working, you should see a big image from flickr. You hover over that image, and you should see the image title and the description from flickr slide up onto the image, and if you mouse-off, the details will float back down.

The animation and hover effect is created with jQuery and a plugin for jQuery called hoverIntent. I had to add hoverIntent because I wanted a delay between mousing off the image and the slide-down. Doing this part, including writing the CSS and javascript, was actually only about an hour’s worth of coding at the most, and the only reason it took that long was because I screwed up including the script, and then I wanted that delay and had to go find out how to do that with hoverIntent.

Where things really got sticky was figuring out how to get the data from Flickr onto my page.

Here’s why: there are basically two plugins that you can use with WordPress to talk to Flickr. Unfortunately, neither one did exactly what I wanted. After playing with Falbum and FlickrRSS, I decided FlickrRSS was going to be the easiest for me to beat into submission. Important caveat: WordPress runs on PHP. I’ve worked with PHP off and on for the last 8 years, but I have never really learned it. I am NOT a programmer–I am a designer. A programmer probably could have written the code to do what I wanted to do here in about an hour. If a client had asked me to do this kind of modification, I would have contracted out the work to an expert. But I’m cheap and I took it as a learning opportunity, so I beat my head on it instead. So, moving on:

The first problem I had was that by default, FlickrRSS could display images, but had no options for displaying the title of the image and the description from flickr. My design plans called for this data. So first, I had to dig around in the Flickr API, look through the different feed types ,and look at the source code of my flickr RSS feed to see if it provided what I needed. It did, but unfortunately, the area of the feed that provided that also provided a damned “JeremyT has posted a photo:” and an img tag including the image before even running the description. This information needed to be stripped. It was pretty easy for me to figure out how to write the PHP to start displaying that information, and even style it. But I needed to figure out how to take that information and strip out the img tag and the “JeremyT has posted a photo:” string. This took me down the rabbit hole of PHP functions and operators and all a bunch of stuff that I understand at a basic level due to all the work I’ve put into Actionscript at the day job. Eventually, through Google-fu, I found str_replace, and that worked fine. There’s probably a better function, but I couldn’t find it. I also used striptags, and provided a list of tags that were okay. Paragraph, bold, italics, and so on.

I describe it, and it sounds so easy, but the constant tweaking, the uploading and testing, then testing again–that’s what too so long. And my solution involved hacking the code in such a way that my desired effect is going to happen for every image I try and display anywhere. I will take advantage of this and provide more popups, or I’ll use CSS to hide that information. I just need to modify some IDs into classes and it’ll be more flexible.

So, one technical hurdle overcome–three hundred to go! God help me, this program stuff is actually kind of fun. JQuery is especially cool.

Like This Post?

Spread the word: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • e-mail
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

Leave a Reply

About Me

Hi! My name is Jeremiah Tolbert, but you can call me Jeremy. I am a fantasy and science fiction writer, photographer, and web designer living in Northern Colorado. By day, I work as a designer for a background screening firm. I am currently available for freelance design work. Drop me a line if you have any questions or comments. I love hearing from new people.

My Best Content

  • On The Popularity of Steampunk 11:07 am May 8, 2008
    Filed Under: Graphic Design, Speculative Fiction, Top Post

    Image via Wikipedia

    Does the New York Times article on Steampunk mean the genre/fashion craze has made the high water mark and will begin to recede from here? What is the shelf-life of an aesthetic movement, and for that matter, what is the sociological force behind this particular movement?
    It’s a Stylistic Rebellion
    Particularly as an aesthetic [...]

    Read More >>

  • Anatomy of a Steampunk Photoshoot 11:20 am May 1, 2008
    Filed Under: Featured Resource, Photography, Top Post, Tutorial

    This was my first serious shoot with logistics involving a model, costuming, and a shoot location. To spend an hour and a half behind the camera, I spent probably 4 hours doing the various administrative tasks to set up. Here’s an overview of the process we went through to get the pictures I wanted.
    The [...]

    Read More >>

  • Clay Shirky and The Cognitive Surplus 2:02 pm April 29, 2008
    Filed Under: Speculative Fiction/SF Business, Science, Top Post

    Continuing on the thoughts of yesterday’s post, I’ve recently read Clay Shirky’s speech, “Gin, Television, and Social Surplus.” You can read a transcript of it, or watch a video. I highly recommend checking out one or the other and coming back here. I’ll wait. For the lazy, here’’s a choice bit [...]

    Read More >>

  • Making FlickrRSS Work for Me 10:48 pm April 10, 2008
    Filed Under: Web Design/Javascript, Top Post

    My goal with this new site is to not only to design a very clean, beautiful site, but to also showcase some of the nice effects that are possible with javascript libraries like jQuery (and teach myself how to effectively use them in the process). Last night, I worked for over 6 hours simply [...]

    Read More >>

  • Why Giant Mecha Robots Are Totally Awesome 10:00 am February 7, 2008
    Filed Under: Speculative Fiction, Top Post

    Sci-fi rant: Why giant mecha robots are stupid | Geekend | TechRepublic.com
    Jay Garmon has written a very well thought-out article on why giant mecha robots are stupid and will never work. I am afraid I must provide a counter to this article. Giant mecha robots are also totally awesome, and I think he’s wrong. [...]

    Read More >>

Previous Photos at Flickr

Buzzard

Buzzard

>>>>

More tree mycoids

More tree mycoids

>>>>

Tree mycoid

Tree mycoid

>>>>

Pelican?

Pelican?

>>>>

Another hatch

Another hatch

>>>>

Stacked mushrooms

Stacked mushrooms

>>>>

Blackbird Portrait

Blackbird Portrait

A redwing blackbird at the ponds area. This is another test of the new lens, and for once, this is a full frame image.

>>>>

The rare female

The rare female

>>>>

I see you

I see you

>>>>

Garter Snake

Garter Snake

>>>>

Through the branches

Through the branches

>>>>

Redwing Sits Proud

Redwing Sits Proud

>>>>


See More Photos at Flickr