Commit 792227ebb311b24d7420bd2271ba3ab3922ed628
Exists in
master
and in
21 other branches
Merge branch 'image-subpath' into 'master'
Consider subdirectory in some images path Small fixies to allow blog posts present images when Noosfero is running in a subdirectory See merge request !694
Showing
2 changed files
with
2 additions
and
2 deletions
Show diff stats
app/models/article.rb
... | ... | @@ -809,7 +809,7 @@ class Article < ActiveRecord::Base |
809 | 809 | end |
810 | 810 | |
811 | 811 | def first_image |
812 | - img = ( image.present? && { 'src' => image.public_filename } ) || | |
812 | + img = ( image.present? && { 'src' => File.join([Noosfero.root, image.public_filename].join) } ) || | |
813 | 813 | Nokogiri::HTML.fragment(self.lead.to_s).css('img[src]').first || |
814 | 814 | Nokogiri::HTML.fragment(self.body.to_s).search('img').first |
815 | 815 | img.nil? ? '' : img['src'] | ... | ... |
app/views/cms/media_panel/_image.html.erb
1 | 1 | <div class="item image" data-item="span" title="<%= @file.name %>"> |
2 | 2 | <span> |
3 | - <img src="<%= @file.public_filename(:uploaded) %>"/> | |
3 | + <%= image_tag(@file.public_filename(:uploaded)) %> | |
4 | 4 | </span> |
5 | 5 | <div class="controls image-controls"> |
6 | 6 | <a class="button icon-add add-to-text" href="#"><span><%= _('Add to the text') %></span></a> | ... | ... |