Skip to content

Instantly share code, notes, and snippets.

@djanowski
Created October 31, 2008 19:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djanowski/21404 to your computer and use it in GitHub Desktop.
Save djanowski/21404 to your computer and use it in GitHub Desktop.
def image_tag(source, options = {})
if options.is_a?(Hash) && source !~ /^http/
size = `identify public/images/#{source}`[/ (\d+x\d+) /, 1]
if options[:size]
if options[:size] != size
line = "*** WRONG SIZE SPECIFIED FOR #{source}: :size => #{size.inspect} ***"
end
else
line = "*** SIZE NOT SPECIFIED FOR #{source}: :size => #{size.inspect} ***"
end
logger.warn(<<-EOS) unless line.blank?
#{'*' * line.size}
#{line}
#{'*' * line.size}
EOS
end
super
end if Rails.env == 'development' || Rails.env == 'test'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment