This post originated from an RSS feed registered with Ruby Buzz
by Premshree Pillai.
Original Post: Spell with Flickr
Feed Title: Premshree's Personal Weblog
Feed URL: http://premshree.livejournal.com/data/rss
Feed Description: Premshree's Weblog
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Premshree Pillai
Latest Posts From Premshree's Personal Weblog
Advertisement
Wow, tags are fun! That image is created using a little script. Basically, it takes a word, searches for photos in the One Letter group on Flickr, and then creates a composite image. Yes, it’s a Ruby script. Yes, it uses flickr-ruby . Original idea from here .
Ruby code »
#!/usr/local/bin/ruby
##
# $premshree$ $2005-03-30 19:31$
# Spell with Flickr
# Original idea: http://metaatem.net/words/
##
require 'flickr-ruby'
require 'net/http'
text = ARGV[0]
chars = text.split('')
imagemagickPath = "/usr/local/bin";
def dumpImage(url, filename)
resp = Net::HTTP.get_response(URI.parse(url))
imageData = resp.body
File.open(filename, 'wb') { |f|
f << imageData
}
filename
end
group = Group.new('27034531@N00')
execCmd = ''
chars.each { |char|
photos = group.getPhotos([char.upcase])
photos << group.getPhotos([(char*2).upcase])
photoId = photos[0]
photoUrl = photoId.getURL('Thumbnail', 'source')
p photoUrl
dumpImage(photoUrl, char)
execCmd += char + ' '
}
exec("#{imagemagickPath}/convert +append #{execCmd}#{text}")
Usage: ruby spell.rb SomeText
Read: Spell with Flickr