The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Spell with Flickr

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Premshree Pillai

Posts: 478
Nickname: premshree
Registered: Mar, 2004

Premshree Pillai is a Ruby evangelist, working with Yahoo!.
Spell with Flickr Posted: Mar 30, 2005 10:59 AM
Reply to this message Reply

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

Topic: Book recommendation needed Previous Topic   Next Topic Topic: St. Louis Ruby User Group

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use