4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/locomotive/dragonfly.rb', line 4
def self.resize_url(source, resize_string)
file = nil
if source.is_a?(String) || source.is_a?(Hash) source = source['url'] if source.is_a?(Hash)
source.strip!
if source =~ /^http/
file = self.app.fetch_url(source)
else
file = self.app.fetch_file(File.join('public', source))
end
elsif source.respond_to?(:url) if source.file.respond_to?(:url)
file = self.app.fetch_url(source.url) else
file = self.app.fetch_file(source.path)
end
else
Locomotive.log :error, "Unable to resize on the fly: #{source.inspect}"
return
end
file.process(:thumb, resize_string).url
end
|