プロジェクト

全般

プロフィール

Vote #81365

完了

Gantt PNG export ignores imagemagick_convert_command

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Gantt_34
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
34
version_id:
171
issue_org_id:
35027
author_id:
332
assigned_to_id:
107353
comments:
9
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
127
ステータス-->[Closed]

説明

Gantt PNG export uses ImageMagick's convert command, but it ignores imagemagick_convert_command in configration.yml.

Steps to reproduce:

  1. Set incorrect command name (e.g. @/usr/bin/_convert@) to imagemagick_convert_command in configration.yml
  2. Restart Redmine
  3. Export gantt to PNG. It should not work because imagemagick_convert_command is wrong, but it works fine.

journals

It seems that you can set the path of Imagemagick's client command to @MiniMagick.cli_path@.
https://rubydoc.info/github/minimagick/minimagick/MiniMagick/Configuration#cli_path-instance_method

I created a patch.

<pre><code class="diff">
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index 122013e5a..7d078298c 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -395,6 +395,9 @@ module Redmine
Redmine::Configuration['minimagick_font_path'].presence ||
Redmine::Configuration['rmagick_font_path'].presence
img = MiniMagick::Image.create(".#{format}", false)
+ if Redmine::Configuration['imagemagick_convert_command'].present?
+ MiniMagick.cli_path = File.dirname(Redmine::Configuration['imagemagick_convert_command'])
+ end
MiniMagick::Tool::Convert.new do |gc|
gc.size('%dx%d' % [subject_width + g_width + 1, height])
gc.xc('white')
</code></pre>
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
I tried this patch on #35424 but that did not fix the issue. Maybe something else is happening, but I'm not enough of a connoisseur :-)
--------------------------------------------------------------------------------
Setting the target version to 4.1.6.
--------------------------------------------------------------------------------
Patch committed, thanks!

The patch can fix some issues when the @convert@ command is not available in the global path, but the binary always must be named @convert@.

Based on the example from #35424, setting @imagemagick_convert_command: /usr/local/bin/convert@ will generate the following:
* @MiniMagick.cli_path@ (used for Gantt PNG) will be set to @/usr/local/bin@ and MiniMagick will look after @convert@ binary inside that path.
* For thumbnail generation, it will be used the exact path from configuration: @/usr/local/bin/convert@.

In case of a different binary name (@convert2@ for example), the Gantt PNG will not work.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

--------------------------------------------------------------------------------


related_issues

relates,Reopened,35424,https://www.redmine.org/boards/2/topics/65661

Admin Redmine さんが3年以上前に更新

  • カテゴリGantt_34 にセット
  • 対象バージョン4.1.6_171 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0