8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/imageurl.rb', line 8
def image_url_for(url, options = {:format => :medium} )
raise ArgumentError unless valid_url?(url)
url = "http://" + url unless url =~ /^http:\/\//
if yfrog_url?(url)
suffix = case options.delete(:format)
when :medium; ":medium"
when :iphone; ":iphone"
when :small; ":small"
when :thumb; ":small"
end
raise ArgumentError unless suffix
url + suffix
else
"https://twitpic.com/show/large/#{url.gsub(/^.*\//, "")}"
end
end
|