Defect #35424
closedhttps://www.redmine.org/boards/2/topics/65661
0%
Description
Problem:
PNG export of GANTT chart throws an error: You must have ImageMagick or GraphicsMagick installed.

Environment:
Redmine version 4.2.1.stable Ruby version 2.7.3-p183 (2021-04-05) [amd64-freebsd12] Rails version 5.2.6 Environment development Database adapter Mysql2 Mailer queue ActiveJob::QueueAdapters::AsyncAdapter Mailer delivery sendmail
Redmine checks:
Default administrator account changed: ok Attachments directory writable: ok Plugin assets directory writable (./public/plugin_assets): ok MiniMagick available (optional): ok ImageMagick convert available (optional): ok ImageMagick PDF support available (optional): ok
OS:
FreeBSD 13.0 in AMD64
Libraries:
ImageMagick7-7.0.11.12: installed rubygem-mini_magick-4.10.1: installed
Configuration.yml: (relevant part / leading whitespace = two spaces)
default: rmagick_font_path: /usr/local/share/fonts/dejavu/DejaVuSans.ttf imagemagick_convert_command: /usr/local/bin/convert
Description:
I cannot seem to use MiniMagick to export the PNG, but I have Image Magick installed, and the convert executable is working on command line.
I tried this patch #35027 but without change.
Somehow I think that MiniMagick::Tool::Convert is not using or finding the correct path to /usr/local/bin/convert.
I made a link to /usr/bin/convert: no success.
I tried running convert as user www: works fine on command line.
Help would be appreciated.
Best regards,
Jan
Files
Related issues
       Updated by Go MAEDA over 4 years ago
      Updated by Go MAEDA over 4 years ago
      
    
    - Status changed from New to Closed
- Resolution set to Duplicate
I am closing this issue because the problem is being tracked in #35027.
       Updated by Go MAEDA over 4 years ago
      Updated by Go MAEDA over 4 years ago
      
    
    - Is duplicate of Defect #35027: Gantt PNG export ignores imagemagick_convert_command added
       Updated by Marius BĂLTEANU over 3 years ago
      Updated by Marius BĂLTEANU over 3 years ago
      
    
    - Status changed from Closed to Reopened
       Updated by Marius BĂLTEANU over 3 years ago
      Updated by Marius BĂLTEANU over 3 years ago
      
    
    - Status changed from Reopened to Closed
       Updated by Marius BĂLTEANU over 3 years ago
      Updated by Marius BĂLTEANU over 3 years ago
      
    
    - Is duplicate of deleted (Defect #35027: Gantt PNG export ignores imagemagick_convert_command)
       Updated by Marius BĂLTEANU over 3 years ago
      Updated by Marius BĂLTEANU over 3 years ago
      
    
    - Related to Defect #35027: Gantt PNG export ignores imagemagick_convert_command added
       Updated by Marius BĂLTEANU over 3 years ago
      Updated by Marius BĂLTEANU over 3 years ago
      
    
    - Status changed from Closed to Reopened
- Resolution deleted (Duplicate)
       Updated by Jan Catrysse over 3 years ago
      Updated by Jan Catrysse over 3 years ago
      
    
    Hello Marius,
This is indeed related to #36231
I looked at my log files and nothing more to see over there, I am afraid.
I was testing this again, and now it doesn't work on either environments (two different servers): test, dev nor production. Furthermore, I am not sure what changed in between tests, probably only some updated gems.
I removed all plugins before testing.
A thing I noticed on my environment (FreeBSD) relating to Redmine and Rails, but I don't know if this plays a role:
Code Page conversion doesn't seem as forgiving as on other environments, I needed to add force_encoding(UTF-8) on a mail plugin to prevent code page errors. Whilst all my code page settings, database etc. are verified UTF-8.
The error seems to come from: \usr\local\lib\ruby\gems\2.7\gems\mini_magick-4.11.0
    def cli
      if instance_variable_defined?("@cli")
        instance_variable_get("@cli")
      else
        cli = CLI_DETECTION.key(processor) or
          fail MiniMagick::Error, "You must have ImageMagick or GraphicsMagick installed" 
        instance_variable_set("@cli", cli)
      end
    end
       Updated by Jan Catrysse over 3 years ago
      Updated by Jan Catrysse over 3 years ago
      
    
    I did fount this in my log, but I don't think it helps.
MiniMagick::Error (You must have ImageMagick or GraphicsMagick installed): lib/redmine/helpers/gantt.rb:402:in `to_image' app/controllers/gantts_controller.rb:46:in `block (2 levels) in show' app/controllers/gantts_controller.rb:42:in `show' lib/redmine/sudo_mode.rb:61:in `sudo_mode'
       Updated by Jan Catrysse over 3 years ago
      Updated by Jan Catrysse over 3 years ago
      
    
    
mini_magick (4.11.0) lib/mini_magick/configuration.rb:139:in `cli'
mini_magick (4.11.0) lib/mini_magick.rb:38:in `imagemagick7?'
mini_magick (4.11.0) lib/mini_magick/tool.rb:135:in `executable'
mini_magick (4.11.0) lib/mini_magick/tool.rb:110:in `command'
mini_magick (4.11.0) lib/mini_magick/tool.rb:92:in `call'
mini_magick (4.11.0) lib/mini_magick/tool.rb:38:in `new'
actionpack (5.2.6) lib/action_controller/metal/mime_responds.rb:203:in `respond_to'
actionpack (5.2.6) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (5.2.6) lib/abstract_controller/base.rb:194:in `process_action'
actionpack (5.2.6) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.2.6) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (5.2.6) lib/active_support/callbacks.rb:109:in `block in run_callbacks'
activesupport (5.2.6) lib/active_support/callbacks.rb:118:in `block in run_callbacks'
activesupport (5.2.6) lib/active_support/callbacks.rb:136:in `run_callbacks'
actionpack (5.2.6) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (5.2.6) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (5.2.6) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (5.2.6) lib/active_support/notifications.rb:168:in `block in instrument'
activesupport (5.2.6) lib/active_support/notifications/instrumenter.rb:23:in `instrument'
activesupport (5.2.6) lib/active_support/notifications.rb:168:in `instrument'
actionpack (5.2.6) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
actionpack (5.2.6) lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
activerecord (5.2.6) lib/active_record/railties/controller_runtime.rb:24:in `process_action'
actionpack (5.2.6) lib/abstract_controller/base.rb:134:in `process'
actionview (5.2.6) lib/action_view/rendering.rb:32:in `process'
actionpack (5.2.6) lib/action_controller/metal.rb:191:in `dispatch'
actionpack (5.2.6) lib/action_controller/metal.rb:252:in `dispatch'
actionpack (5.2.6) lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
actionpack (5.2.6) lib/action_dispatch/routing/route_set.rb:34:in `serve'
actionpack (5.2.6) lib/action_dispatch/journey/router.rb:52:in `block in serve'
actionpack (5.2.6) lib/action_dispatch/journey/router.rb:35:in `each'
actionpack (5.2.6) lib/action_dispatch/journey/router.rb:35:in `serve'
actionpack (5.2.6) lib/action_dispatch/routing/route_set.rb:840:in `call'
rack-openid (1.4.2) lib/rack/openid.rb:98:in `call'
rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.3) lib/rack/etag.rb:27:in `call'
rack (2.2.3) lib/rack/conditional_get.rb:27:in `call'
rack (2.2.3) lib/rack/head.rb:12:in `call'
actionpack (5.2.6) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (5.2.6) lib/action_dispatch/middleware/cookies.rb:670:in `call'
actionpack (5.2.6) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (5.2.6) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (5.2.6) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (5.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
actionpack (5.2.6) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.6) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.6) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.6) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.6) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.6) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.6) lib/rails/rack/logger.rb:26:in `call'
actionpack (5.2.6) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
request_store (1.5.1) lib/request_store/middleware.rb:19:in `call'
actionpack (5.2.6) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.2.3) lib/rack/method_override.rb:24:in `call'
rack (2.2.3) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.6) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.6) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
rack (2.2.3) lib/rack/content_length.rb:17:in `call'
railties (5.2.6) lib/rails/engine.rb:524:in `call'
/usr/local/lib/ruby/gems/2.7/gems/passenger/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb:107:in `process_request'
/usr/local/lib/ruby/gems/2.7/gems/passenger/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:149:in `accept_and_process_next_request'
/usr/local/lib/ruby/gems/2.7/gems/passenger/src/ruby_supportlib/phusion_passenger/request_handler/thread_handler.rb:110:in `main_loop'
/usr/local/lib/ruby/gems/2.7/gems/passenger/src/ruby_supportlib/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
/usr/local/lib/ruby/gems/2.7/gems/passenger/src/ruby_supportlib/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'
Request
Parameters:
{"c"=>
  ["status",
   "priority",
   "assigned_to",
   "updated_on",
   "parent",
   "parent.subject",
   "start_date",
   "due_date",
   "estimated_hours",
   "total_estimated_hours",
   "spent_hours",
   "total_spent_hours",
   "done_ratio"],
 "f"=>["status_id", ""],
 "gantt"=>"1",
 "month"=>"2",
 "months"=>"2",
 "op"=>{"status_id"=>"o"},
 "query"=>{"draw_progress_line"=>"0", "draw_relations"=>"1", "draw_selected_columns"=>"1"},
 "set_filter"=>"1",
 "utf8"=>"✓",
 "year"=>"2022",
 "zoom"=>"4",
 "project_id"=>"test-git-jan",
 "format"=>"png"}
       Updated by Jan Catrysse over 3 years ago
      Updated by Jan Catrysse over 3 years ago
      
    
    I fixed this by changing MiniMagick.cli = :imagemagick to lib/redmine/helpers/gantt.rb
if Redmine::Configuration['imagemagick_convert_command'].present?
    MiniMagick.cli_path = File.dirname(Redmine::Configuration['imagemagick_convert_command'])
    MiniMagick.cli = :imagemagick
end
       Updated by Marius BĂLTEANU over 3 years ago
      Updated by Marius BĂLTEANU over 3 years ago
      
    
    - Has duplicate Defect #36231: https://stackoverflow.com/questions/69910539/minimagickerror-you-must-have-imagemagick-or-graphicsmagick-installed-on-red added
       Updated by Marius BĂLTEANU about 2 months ago
      Updated by Marius BĂLTEANU about 2 months ago
      
    
    - Status changed from Reopened to Closed
- Assignee set to Marius BĂLTEANU
- Resolution set to Fixed