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 committed by Thomas Reynolds
parent 01e9c336b0
commit 4b7411b08a

View file

@ -30,7 +30,11 @@ module Middleman
# @param [Hash] params # @param [Hash] params
# @return [String] # @return [String]
def image_tag(path, params={}) 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] ||= "" params[:alt] ||= ""
real_path = path real_path = path