def picture_src src, *args
      options = args.extract_options!
      media = args.first.to_s if args.first.kind_of?(String) || args.first.kind_of?(Fixnum)

      tag = options[:tag] || :div
      ratio_opt = options.delete(:ratio)
      media_opt = Picturefill::ViewHelper.extract media unless media.blank? 

      unless media_opt && media_opt =~ /min-device-pixel-ratio/
        # use filename to provide ratio_opt
        filename = Picturefill::ViewHelper.filename(src).first
        fn = filename =~ /_x\d(\d)?/
        if fn && !ratio_opt
          ratio_opt = filename.match(/x\d(\d)?$/).to_s
        else
          auto_ratio_tag = ratio_opt[0] == 'x' unless ratio_opt.blank?
        end
        ratio = Picturefill::ViewHelper.ratio_attrib(ratio_opt) unless ratio_opt.blank?
        media_opt = [media_opt, ratio].compact.join(' and ')
      end
      
      next_content = if auto_ratio_tag
        opts = options.dup
        filename = Picturefill::ViewHelper.ratio_file_name src, ratio_opt
        opts.merge!(:ratio => ratio_opt.delete('x'))
        picture_src filename, media, opts
      end

      options.merge! :"data-media" => media_opt unless auto_ratio_tag || media_opt.blank?
      options.merge! :"data-src" => src      

      content_tag(tag, nil, options) + next_content
    end
def picture_src src, *args
      options = args.extract_options!
      media = args.first.to_s if args.first.kind_of?(String) || args.first.kind_of?(Fixnum)

      tag = options[:tag] || :div
      ratio_opt = options.delete(:ratio)
      media_opt = Picturefill::ViewHelper.extract media unless media.blank? 

      unless media_opt && media_opt =~ /min-device-pixel-ratio/
        # use filename to provide ratio_opt
        filename = Picturefill::ViewHelper.filename(src).first
        fn = filename =~ /_x\d(\d)?/
        if fn && !ratio_opt
          ratio_opt = filename.match(/x\d(\d)?$/).to_s
        else
          auto_ratio_tag = ratio_opt[0] == 'x' unless ratio_opt.blank?
        end
        ratio = Picturefill::ViewHelper.ratio_attrib(ratio_opt) unless ratio_opt.blank?
        media_opt = [media_opt, ratio].compact.join(' and ')
      end
      
      next_content = if auto_ratio_tag
        opts = options.dup
        filename = Picturefill::ViewHelper.ratio_file_name src, ratio_opt
        opts.merge!(:ratio => ratio_opt.delete('x'))
        picture_src filename, media, opts
      end

      options.merge! :"data-media" => media_opt unless auto_ratio_tag || media_opt.blank?
      options.merge! :"data-src" => src      

      content_tag(tag, nil, options) + next_content
    end
UGLY AS HELL!!! Needs refactor :P