diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2c334b7..6f47b50 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -495,12 +495,22 @@ module ApplicationHelper attachments ||= (options[:attachments] || obj.attachments).sort_by(&:created_on).reverse # search for the picture in attachments if found = attachments.detect { |att| att.filename.downcase == filename } - image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found desc = found.description.to_s.gsub('"', '') - if !desc.blank? && alttext.blank? + if !desc.blank? && alttext.blank? alt = " title=\"#{desc}\" alt=\"#{desc}\"" - end - "src=\"#{image_url}\"#{alt}" + else + alt = "" + end + + case options[:wiki_links] + when :local + "src=\"data:#{found.content_type};base64,#{Base64.b64encode(File.read(found.diskfile)).gsub(/\n/,"")}\"#{alt}" + when :anchor + "src=\"data:#{found.content_type};base64,#{Base64.b64encode(File.read(found.diskfile)).gsub(/\n/,"")}\"#{alt}" + else + image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found + "src=\"#{image_url}#{alt}\"" + end else m end diff --git a/app/views/wiki/export.rhtml b/app/views/wiki/export.rhtml index da45423..0f70f8f 100644 --- a/app/views/wiki/export.rhtml +++ b/app/views/wiki/export.rhtml @@ -16,6 +16,6 @@ h1:hover a.wiki-anchor, h2:hover a.wiki-anchor, h3:hover a.wiki-anchor { display -<%= textilizable @content, :text, :wiki_links => :local %> + <%= textilizable @content, :text, :wiki_links => :local, :attachments => @content.page.attachments %> diff --git a/app/views/wiki/export_multiple.rhtml b/app/views/wiki/export_multiple.rhtml index 31fa557..6716fc1 100644 --- a/app/views/wiki/export_multiple.rhtml +++ b/app/views/wiki/export_multiple.rhtml @@ -27,7 +27,7 @@ h1:hover a.wiki-anchor, h2:hover a.wiki-anchor, h3:hover a.wiki-anchor { display <% @pages.each do |page| %>
-<%= textilizable page.content ,:text, :wiki_links => :anchor %> + <%= textilizable page.content ,:text, :wiki_links => :anchor, :attachments => page.attachments %> <% end %>