Premshree Pillai ([info]premshree) wrote,
@ 2005-03-30 19:42:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
Current music:Stevie Ray Vaughan And Double Trouble - Pride And Joy

Spell with Flickr

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



(Post a new comment)


[info]harishforu
2005-03-30 03:54 pm UTC (link)
Awesome!!

(Reply to this)(Thread)


[info]premshree
2005-03-30 04:52 pm UTC (link)
No work today? :-)

(Reply to this)(Parent)


Create an Account
Forgot your login?
Login w/ OpenID
English • Español • Deutsch • Русский…