Project

General

Profile

How can I display a preview of attachment in issue

Added by Brett Communes almost 13 years ago

Hello,

I did not know much about ruby practices and shortcuts tags.
I would like to display a preview of image attachment in issues to help contributors reviewing screen capture.

I see a function "image" in attachment.rb, I guess it detects attachment type.

So i've edited without any success views/attachments/_links.rhtml


  <% if options[:image] %>
  <p class="preview">
  <%= image_tag(attachment.filename, :size => "640x480", :alt => "Preview")  %>
  </p>
  <% end %>

The if condition isn't matched and even if I remove it and just want to display

<%= image_tag(attachment.filename, :size => "640x480", :alt => "Preview")  %>

It returns
<img alt="Preview" height="480" src="/redmine/images/Capture.png" width="640">

In place of
<img alt="Preview" height="480" src="/redmine/attachments/3/Capture.png" width="640">

I've tried with attachment.disk_filename, attachment.file, attachment.filename without success...

It must be obvious for you, but I can't find the trick to display an image :(

If there is a more common way through redmine options or some kind of modules/plugins i'm interested to.

Thanks in advance for any help !