Merge pull request #508 from chris-ibcsf/master

added feature to scale down inline images with respect to aspect ratio
This commit is contained in:
Karel Picman 2016-02-17 08:24:39 +01:00
commit a0223234a8
2 changed files with 8 additions and 1 deletions

View File

@ -119,6 +119,9 @@ Search will now automatically search DMSF content when a Redmine search is perfo
####An inline picture with custom size
`{{dmsf_image(8, size=300)}}`
####An inline picture with custom size
`{{dmsf_image(8, size=50%)}}`
####An inline picture with custom size
`{{dmsf_image(8, size=640x480)}}`

View File

@ -181,7 +181,11 @@ Redmine::Plugin.register :redmine_dmsf do
end
raise 'Not supported image format' unless file.image?
url = url_for(:controller => :dmsf_files, :action => 'view', :id => file)
image_tag(url, :alt => file.title, :size => size)
if size.include? "%"
image_tag(url, :alt => file.title, :width => size, :height => size)
else
image_tag(url, :alt => file.title, :size => size)
end
else
raise "Document ID #{file_id} not found"
end