Fixing image_tag helper so it only attempts to auto image sizes file extensions supported by FastImage. This can be overriden by passing param :supported_extensions into the image_tag helper.

This commit is contained in:
Daniel Jabbour 2012-11-05 18:09:30 -08:00
parent 0eb906efac
commit 8606fb4eba

View file

@ -30,7 +30,11 @@ module Middleman
# @param [Hash] params
# @return [String]
def image_tag(path, params={})
if !params.has_key?(:width) && !params.has_key?(:height) && !path.include?("://")
params[:supported_extensions] ||= %w(.png .jpg .jpeg .bmp .gif)
if !params.has_key?(:width) && !params.has_key?(:height) && !path.include?("://") &&
params[:supported_extensions].include?(File.extname(path).downcase)
params[:alt] ||= ""
real_path = path