*** app/helpers/application_helper.rb.orig 2012-05-14 16:52:18.442136891 -0500 --- app/helpers/application_helper.rb 2012-05-15 13:21:11.027958465 -0500 *************** *** 570,577 **** # when using an image link, try to use an attachment, if possible if options[:attachments] || (obj && obj.respond_to?(:attachments)) attachments = options[:attachments] || obj.attachments ! text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| ! filename, ext, alt, alttext = $1.downcase, $2, $3, $4 # search for the picture in attachments if found = Attachment.latest_attach(attachments, filename) image_url = url_for :only_path => only_path, :controller => 'attachments', --- 570,579 ---- # when using an image link, try to use an attachment, if possible if options[:attachments] || (obj && obj.respond_to?(:attachments)) attachments = options[:attachments] || obj.attachments ! text.gsub!(/((]+src\s*=\s*)|(]+href\s*=\s*))(("[^"]+")|('[^']+'))(\s+alt="([^"]*)")?/i) do |m| ! prefix = $1 ! filename = $4.downcase.gsub(/^["'](.+)["']$/, '\1') ! alt, alttext = $5, $6 # search for the picture in attachments if found = Attachment.latest_attach(attachments, filename) image_url = url_for :only_path => only_path, :controller => 'attachments', *************** *** 580,586 **** if !desc.blank? && alttext.blank? alt = " title=\"#{desc}\" alt=\"#{desc}\"" end ! "src=\"#{image_url}\"#{alt}" else m end --- 582,592 ---- if !desc.blank? && alttext.blank? alt = " title=\"#{desc}\" alt=\"#{desc}\"" end ! if prefix=~ /^