Project

General

Profile

Actions

Defect #32289

closed

Don't try to generate thumbnails if convert command is not available

Added by Go MAEDA over 4 years ago. Updated over 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Attachments
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Currently, Redmine always tries to render attachment thumbnails if the setting "Display attachment thumbnails" is enabled even when ImageMagick's convert command is not available. As a result, users may see broken image icons.

I think such broken things should not be displayed. Redmine should not try to generate thumbnails if the command to create thumbnails is not available.


Files


Related issues

Blocks Redmine - Feature #32249: Show attachment thumbnails by defaultClosedGo MAEDA

Actions
Actions #1

Updated by Go MAEDA over 4 years ago

Actions #2

Updated by Yuichi HARADA over 4 years ago

The following patch will determine if ImageMagick's convert command is available. I attached a patch.

diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 8304d4dea..627c1a181 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -201,7 +201,9 @@ class Attachment < ActiveRecord::Base
   end

   def thumbnailable?
-    image? || (is_pdf? && Redmine::Thumbnail.gs_available?)
+    Redmine::Thumbnail.convert_available? && (
+      image? || (is_pdf? && Redmine::Thumbnail.gs_available?)
+    )
   end

   # Returns the full path the attachment thumbnail, or nil
Actions #3

Updated by Go MAEDA over 4 years ago

  • Target version set to Candidate for next major release
Actions #4

Updated by Go MAEDA over 4 years ago

LGTM. Updated the test name.

Setting the target version to 4.1.0.

Actions #5

Updated by Go MAEDA over 4 years ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Committed the patch.

Actions

Also available in: Atom PDF