我正在尝试使用活动存储和imageimagick裁剪图像,但是我一直遇到错误 这是我正在尝试的对话:
main_app.url_for(binary.variant(
combine_options: {
crop: '50x50^',
gravity: 'center',
strip: true
}
)
)
这是我不断得到的错误:
Processing by ActiveStorage::RepresentationsController#show as JPEG
Parameters: {"signed_blob_id"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBmZz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--841a9aece3665b711eaff9225c9e9e93a135e06f", "variation_key"=>"eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VWTI5dFltbHVaVjl2Y0hScGIyNXpld2c2Q1dOeWIzQkpJZ3N6TUhnek1GNEdPZ1pGVkRvTVozSmhkbWwwZVVraUMyTmxiblJsY2dZN0IxUTZDbk4wY21sd1ZBPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--b97bc7d2032017a9664793ac80b6a0a82c71796a", "filename"=>"wow-equipamento-de-personagem-325-D_NQ_NP_625122-MLB28027187242_082018-F"}
Disk Storage (0.4ms) Downloaded file from key: Q8HF86AQMXjXZSM1gYKdhPJ2
ActiveStorage::Blob Load (1.1ms) SELECT "active_storage_blobs".* FROM "active_storage_blobs" WHERE "active_storage_blobs"."id" = $1 LIMIT $2 [["id", 121], ["LIMIT", 1]]
Disk Storage (0.1ms) Checked if file exists at key: variants/enYkshsXTZku84DeUeF5mhWp/e24388da7b18cedbe46c7d2b4f373893ea48c8f6adc1dc3fb0a4843fd8dbac1e (no)
Disk Storage (0.2ms) Downloaded file from key: enYkshsXTZku84DeUeF5mhWp
Completed 500 Internal Server Error in 285ms (ActiveRecord: 1.1ms)
Errno::ENOENT (No such file or directory @ rb_sysopen - /tmp/mini_magick20181013-25003-de7beq.jpg):
activestorage (5.2.1) app/models/active_storage/variant.rb:130:in `initialize'
activestorage (5.2.1) app/models/active_storage/variant.rb:130:in `open'
activestorage (5.2.1) app/models/active_storage/variant.rb:130:in `upload'
activestorage (5.2.1) app/models/active_storage/variant.rb:88:in `block in process'
activestorage (5.2.1) app/models/active_storage/variant.rb:110:in `open_image'
activestorage (5.2.1) app/models/active_storage/variant.rb:85:in `process'
activestorage (5.2.1) app/models/active_storage/variant.rb:53:in `processed'
activestorage (5.2.1) app/controllers/active_storage/representations_controller.rb:12:in `show'
actionpack (5.2.1) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (5.2.1) lib/abstract_controller/base.rb:194:in `process_action'
actionpack (5.2.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.2.1) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (5.2.1) lib/active_support/callbacks.rb:132:in `run_callbacks'
actionpack (5.2.1) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (5.2.1) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (5.2.1) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
activesupport (5.2.1) lib/active_support/notifications.rb:168:in `block in instrument'
activesupport (5.2.1) lib/active_support/notifications/instrumenter.rb:23:in `instrument'
activesupport (5.2.1) lib/active_support/notifications.rb:168:in `instrument'
actionpack (5.2.1) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
actionpack (5.2.1) lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
activerecord (5.2.1) lib/active_record/railties/controller_runtime.rb:24:in `process_action'
actionpack (5.2.1) lib/abstract_controller/base.rb:134:in `process'
actionview (5.2.1) lib/action_view/rendering.rb:32:in `process'
actionpack (5.2.1) lib/action_controller/metal.rb:191:in `dispatch'
actionpack (5.2.1) lib/action_controller/metal.rb:252:in `dispatch'
actionpack (5.2.1) lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
actionpack (5.2.1) lib/action_dispatch/routing/route_set.rb:34:in `serve'
actionpack (5.2.1) lib/action_dispatch/journey/router.rb:52:in `block in serve'
actionpack (5.2.1) lib/action_dispatch/journey/router.rb:35:in `each'
actionpack (5.2.1) lib/action_dispatch/journey/router.rb:35:in `serve'
actionpack (5.2.1) lib/action_dispatch/routing/route_set.rb:840:in `call'
apartment (2.2.0) lib/apartment/elevators/generic.rb:21:in `block in call'
apartment (2.2.0) lib/apartment/adapters/abstract_adapter.rb:85:in `switch'
apartment (2.2.0) lib/apartment/elevators/generic.rb:21:in `call'
apartment (2.2.0) lib/apartment/reloader.rb:18:in `call'
apartment (2.2.0) lib/apartment/elevators/generic.rb:21:in `block in call'
apartment (2.2.0) lib/apartment/adapters/abstract_adapter.rb:85:in `switch'
apartment (2.2.0) lib/apartment/elevators/generic.rb:21:in `call'
warden (1.2.7) lib/warden/manager.rb:36:in `block in call'
warden (1.2.7) lib/warden/manager.rb:35:in `catch'
warden (1.2.7) lib/warden/manager.rb:35:in `call'
rack (2.0.5) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.0.5) lib/rack/etag.rb:25:in `call'
rack (2.0.5) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.5) lib/rack/head.rb:12:in `call'
actionpack (5.2.1) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
rack (2.0.5) lib/rack/session/abstract/id.rb:232:in `context'
rack (2.0.5) lib/rack/session/abstract/id.rb:226:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/cookies.rb:670:in `call'
activerecord (5.2.1) lib/active_record/migration.rb:559:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (5.2.1) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (5.2.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
web-console (3.6.2) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.6.2) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.6.2) lib/web_console/middleware.rb:20:in `catch'
web-console (3.6.2) lib/web_console/middleware.rb:20:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.1) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.1) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.1) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.1) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.1) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.5) lib/rack/method_override.rb:22:in `call'
rack (2.0.5) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.0.5) lib/rack/sendfile.rb:111:in `call'
railties (5.2.1) lib/rails/engine.rb:524:in `call'
puma (3.12.0) lib/puma/configuration.rb:225:in `call'
puma (3.12.0) lib/puma/server.rb:658:in `handle_request'
puma (3.12.0) lib/puma/server.rb:472:in `process_client'
puma (3.12.0) lib/puma/server.rb:332:in `block in run'
puma (3.12.0) lib/puma/thread_pool.rb:133:in `block in spawn_thread'
Completed 500 Internal Server Error in 1058ms (ActiveRecord: 1.1ms)
并且在三个图像之一中,还有一个附加错误:
mogrify: profile 'icc': 'RGB ': RGB color space not permitted on grayscale PNG `/tmp/mini_magick20181013-25003-yiasao.png' @ warning/png.c/MagickPNGWarningHandler/1746.
我在做什么错?有没有更好的方法来裁剪图像?
谢谢!