module Middleman::Features::AutomaticImageSizes::Helpers

def image_tag(path, params={})

def image_tag(path, params={})
  if (!params[:width] || !params[:height]) && !path.include?("://")
    params[:alt] ||= ""
    http_prefix = settings.http_images_path rescue settings.images_dir
    begin
      real_path = File.join(settings.public, settings.images_dir, path)
      if File.exists? real_path
        dimensions = ::FastImage.size(real_path, :raise_on_failure => true)
        params[:width]  ||= dimensions[0]
        params[:height] ||= dimensions[1]
      end
    rescue
    end
    super(asset_url(path, http_prefix), params)
  else
    super(path, params)
  end
end