diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 916bdf1..599df8a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -655,12 +655,19 @@ module ApplicationHelper filename, ext, alt, alttext = $1.downcase, $2, $3, $4 # search for the picture in attachments if found = Attachment.latest_attach(attachments, CGI.unescape(filename)) - image_url = download_named_attachment_path(found, found.filename, :only_path => only_path) desc = found.description.to_s.gsub('"', '') if !desc.blank? && alttext.blank? alt = " title=\"#{desc}\" alt=\"#{desc}\"" end - "src=\"#{image_url}\"#{alt}" + case options[:wiki_links] + when :local + "src=\"data:#{found.content_type};base64,#{Base64.encode64(File.read(found.diskfile)).gsub(/\n/,"")}\"#{alt}" + when :anchor + "src=\"data:#{found.content_type};base64,#{Base64.encode64(File.read(found.diskfile)).gsub(/\n/,"")}\"#{alt}" + else + image_url = download_named_attachment_path(found, found.filename, :only_path => only_path) + "src=\"#{image_url}\"#{alt}" + end else m end diff --git a/app/views/wiki/export.html.erb b/app/views/wiki/export.html.erb index da45423..2fcd91a 100644 --- a/app/views/wiki/export.html.erb +++ b/app/views/wiki/export.html.erb @@ -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.html.erb b/app/views/wiki/export_multiple.html.erb index df8f740..2cb0cdc 100644 --- a/app/views/wiki/export_multiple.html.erb +++ b/app/views/wiki/export_multiple.html.erb @@ -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 %>