diff --git a/README.md b/README.md index 4afc77ba..6af69759 100644 --- a/README.md +++ b/README.md @@ -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)}}` diff --git a/init.rb b/init.rb index 473db794..406f9581 100644 --- a/init.rb +++ b/init.rb @@ -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