From e0f1b4cc54cef6b6ae9910c9ed3b5b37767d9270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Tue, 17 May 2022 14:43:40 +0200 Subject: [PATCH] Check convert available by thumbnails #1357 --- app/models/dmsf_file.rb | 4 ++++ app/views/dmsf_files/_thumbnails.html.erb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index ee890a44..537e8466 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -488,6 +488,10 @@ class DmsfFile < ActiveRecord::Base (image? || pdf? || video? || html?) ? 'inline' : 'attachment' end + def thumbnailable? + image? && Redmine::Thumbnail.convert_available? + end + def preview(limit) result = +'No preview available' if text? diff --git a/app/views/dmsf_files/_thumbnails.html.erb b/app/views/dmsf_files/_thumbnails.html.erb index 13763564..ca8e0a71 100644 --- a/app/views/dmsf_files/_thumbnails.html.erb +++ b/app/views/dmsf_files/_thumbnails.html.erb @@ -22,7 +22,7 @@ <% # Thumbnails %> <% if defined?(thumbnails) && thumbnails %> - <% images = links.map{ |x| x[0] }.select(&:image?) %> + <% images = links.map{ |x| x[0] }.select(&:thumbnailable?) %> <% if images.any? %> <% if link_to # Redmine classic %>