Feature #550 » inlined-images.patch
app/helpers/application_helper.rb | ||
---|---|---|
655 | 655 |
filename, ext, alt, alttext = $1.downcase, $2, $3, $4 |
656 | 656 |
# search for the picture in attachments |
657 | 657 |
if found = Attachment.latest_attach(attachments, CGI.unescape(filename)) |
658 |
image_url = download_named_attachment_path(found, found.filename, :only_path => only_path) |
|
659 | 658 |
desc = found.description.to_s.gsub('"', '') |
660 | 659 |
if !desc.blank? && alttext.blank? |
661 | 660 |
alt = " title=\"#{desc}\" alt=\"#{desc}\"" |
662 | 661 |
end |
663 |
"src=\"#{image_url}\"#{alt}" |
|
662 |
case options[:wiki_links] |
|
663 |
when :local |
|
664 |
"src=\"data:#{found.content_type};base64,#{Base64.encode64(File.read(found.diskfile)).gsub(/\n/,"")}\"#{alt}" |
|
665 |
when :anchor |
|
666 |
"src=\"data:#{found.content_type};base64,#{Base64.encode64(File.read(found.diskfile)).gsub(/\n/,"")}\"#{alt}" |
|
667 |
else |
|
668 |
image_url = download_named_attachment_path(found, found.filename, :only_path => only_path) |
|
669 |
"src=\"#{image_url}\"#{alt}" |
|
670 |
end |
|
664 | 671 |
else |
665 | 672 |
m |
666 | 673 |
end |
app/views/wiki/export.html.erb | ||
---|---|---|
16 | 16 |
</style> |
17 | 17 |
</head> |
18 | 18 |
<body> |
19 |
<%= textilizable @content, :text, :wiki_links => :local %> |
|
19 |
<%= textilizable @content, :text, :wiki_links => :local, :attachments => @content.page.attachments %>
|
|
20 | 20 |
</body> |
21 | 21 |
</html> |
app/views/wiki/export_multiple.html.erb | ||
---|---|---|
27 | 27 |
<% @pages.each do |page| %> |
28 | 28 |
<hr /> |
29 | 29 |
<a name="<%= h(page.title) %>" /> |
30 |
<%= textilizable page.content ,:text, :wiki_links => :anchor %> |
|
30 |
<%= textilizable page.content ,:text, :wiki_links => :anchor, :attachments => page.attachments %>
|
|
31 | 31 |
<% end %> |
32 | 32 | |
33 | 33 |
</body> |
- « Previous
- 1
- 2
- Next »