thoughtbot / paperclip

Easy file attachment management for ActiveRecord
https://thoughtbot.com
Other
9.01k stars 2.43k forks source link

Paperclip::Errors::NotIdentifiedByImageMagickError #1405

Closed fmh closed 10 years ago

fmh commented 10 years ago

Mac OS X 10.9 ImageMagick 6.8.7 installed through brew , '/usr/local/bin/identify' Ruby 2 Rails 4 Paperclip 3.5.2 , cocaine 0.5.3

I tried everything but still not work !!!

fmh commented 10 years ago

i remove the styles: { } part and it works without, but as i need to resize my images this is still a bug without style setting.

jyurek commented 10 years ago

Are you able to identify your images outside of Paperclip? What do you have for your attachment definitions (including the styles)?

fmh commented 10 years ago

thx for your reply,

yes i'm able from terminal

has_attached_file :attachment,
                    :style => { :thumb => '120x120', :large => '300x400' },
                    url: '/readfiles/showfile?f=:accesskey',
                    path: ':rails_root/myfiles/images/:assetable_type/:assetable_id/:id_:style.:extension'
jyurek commented 10 years ago

You said you have IM installed into /usr/local/bin, but did you set Paperclip.options[:command_path] to that? ... Actually, hmm, that isn't raised when it can't find the binaries, but it's still should be done.

What you can do is set Paperclip.options[:log] = true and Paperclip.options[:log_command] = true. This will log the exact command that it's trying to run. You should be able to spot inconsistencies there. If you could paste the log lines from a few attempts here, I can help you debug it.

fmh commented 10 years ago

i change in rails 4 syntax :

style: { thumb: '120x120', large: '300x400' },

in development.rb

  Paperclip.options[:command_path] = "/usr/local/bin/"

and now i havn't error but no styles generate, i have only original style

no paperclip log has been generated , the only log when i upload an image :

  User Load (0.6ms)  SELECT `users`.* FROM `users` WHERE `users`.`tenant_id` = 1 AND `users`.`id` = 5555 ORDER BY `users`.`id` ASC LIMIT 1
  Asset Load (0.3ms)  SELECT `assets`.* FROM `assets` WHERE `assets`.`tenant_id` = 1 AND `assets`.`securekey` = 'cfc5dae61f75ef7dac6dcbcc7e2ba99c70bdbdb5afaaf8fb08a20c4fe104c865' LIMIT 1
Sent file /Users/me/Documents/Dev/RoR/polyappfiles/images/Task/7/39_original.jpg (0.1ms)
Completed 200 OK in 9ms (ActiveRecord: 1.3ms)
jyurek commented 10 years ago

I don't know if this is a transcription error, but it should be styles not style. Though that wouldn't have caused a NotIdentifiedByImageMagick error in the first place.

fmh commented 10 years ago

ok , sorry , it's styles and now i can show error with log Attachment Paperclip::Errors::NotIdentifiedByImageMagickError et Paperclip::Errors::NotIdentifiedByImageMagickError

Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/1n/m9g9hr5x4pv6zl25md1x1hgw0000gn/T/Cover Front20140102-4364-1jzhizc.jpg[0]'
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/1n/m9g9hr5x4pv6zl25md1x1hgw0000gn/T/Cover Front20140102-4364-1jzhizc.jpg[0]'
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
fmh commented 10 years ago

now it works,

in application.rb (must add identify to path) , not work in development.rb

#application.rb
Paperclip.options[:command_path] = "/usr/local/bin/identify"

thank you for your help :)

swathik commented 10 years ago

Hi,

Can you please explain what path needs to be set in application.rb file?

It doesn't work with styles. It throws

  Validation failed: Photo Paperclip::Errors::NotIdentifiedByImageMagickError

After removing the styles it works.

has_attached_file :photo, { styles: {medium: '300x300>', thumb: '150x150>'}, s3_permissions: :private}
dimitarvp commented 10 years ago

This is still a problem, with a JPEG-2000 image at least -- and with http://www.fnordware.com/j2k/relax.jp2 being a contemporary example.

Tried with Paperclip 4.2.0 and with the master branch from the GitHub repo. ImageMagick on my debian is at 6.8.9-6 Q16.

The relevant line in my Rails model is:

has_attached_file :image, styles: { thumb: "200x200#" }, default_url: ""

The only "fix" is to actually remove the styles clause, which kinda defeats half the purpose of Paperclip.

Does any of the devs have any update on this? I am sure I have installed and used Paperclip properly, since the code is working without a glitch for any other image file I threw at it.

(There is still the thing that while I was installing ImageMagick, I didn't install libjpeg62-dev, but rather libmagickwand-dev, but I am not sure that's relevant.)

Output of file -b --mime /shared/jpeg2000.jpg: image/jp2; charset=binary

Output of identify /shared/jpeg2000.jpg: identify: Not a JPEG file: starts with 0x00 0x00/shared/jpeg2000.jpg' @ error/jpeg.c/JPEGErrorHandler/322.`

But hey, this is true for 5 other random JPEG-2000 samples found on the internet. So something's not okay with ImageMagick, it seems.

Hopefully the info I gave is enough for an in-house reproduce by the Paperclip devs.

daraul commented 10 years ago

I'm struggling with this on a small app I'm working on. I took out the styles clause, but like @dimitko stated half the reason for using paperclip in the first place is to use the styles clause. Isn't there a fix as yet?

jahrichie commented 10 years ago

Recently ran through myself. Brew remove imagemagick && brew install imagemagick fixed me up real nice

daraul commented 10 years ago

I had to restart from scratch and reinstall imagemagick using apt-get instead of source like I did in the first place. Seems to work fine so far.

timbica commented 10 years ago

I have this exception when uploading .jpg files using my local MacBook Pro. But in my remote server with Ubuntu it's ok? Can I give more information to help solve this problem?

tiaozi0912 commented 10 years ago

Just solved the same issue today. There are probably problems in the ImageMagick build. Run

identify my_pic.jpg

may give more concrete errors. For me, I got

dyld: Library not loaded: /usr/local/lib/liblzma.5.dylib

Then I uninstalled and reinstalled the ImageMagick with build from source option. More details in this post: http://stackoverflow.com/questions/7412208/imagemagick-and-os-x-lion-trouble#answer-22193610

timbica commented 10 years ago

Thanks but it didn't worked in my case. But then I tried the following working steps:

brew uninstall imagemagick jpeg libtiff
brew install imagemagick
jmoore315 commented 9 years ago

In my case (osx, rails 4.1, imagemagick 6.9), I had to:

brew uninstall imagemagick
brew install imagemagick --build-from-source
loxpa commented 9 years ago

uninitialized constant Recipe::Ingredient

%h3 Ingredients

ingredients

                = f.simple_fields_for :ingredients do |ingredient|
                    = render 'ingredient_fields', f: ingredient
                .links
                    = link_to_add_association 'Add Ingredient', f, :ingredients, class: "btn btn-default add-button"
david-a commented 9 years ago

@jmoore315 thanks worked for me too!

laxmimayee commented 8 years ago

Hi,

Am facing same error in Server production mode.

Error is prompt as below.

[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError> I, [2015-10-28T13:26:25.503831 #578] INFO -- : Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/6a992d5529f459a44fee58c733255e8620151028-578-1035qse.jpeg[0]' 2>/dev/null I, [2015-10-28T13:26:25.511486 #578] INFO -- : [paperclip] An error was received while processing: #

Jatapiaro commented 8 years ago

Hi to everyone, I just solved this issue. brew makes a directory call Cellar, /usr/local/Cellar Verify if you don`t have two ImageMagick, i had one named ImageMagick-Ruby182, so, if you have it run brew uninstall ImageMagick-Ruby182, and also the normal imagemagick, and reinstall image magic.

zulhfreelancer commented 8 years ago

This works for me:

$ brew uninstall imagemagick
$ sudo chown -R my_osx_short_username:admin /usr/local/share/man/man5
$ brew link libpng
$ brew install imagemagick
yesk13 commented 8 years ago

Here is the offending image I have organic mayo though it can be seen here it will fail to open in OSX

screen shot 2016-04-11 at 7 56 00 am

and Adobe Photoshop

`Started POST "/admin/products/organic-mayo-11-dot-25oz/images" for 71.52.37.2 at 2016-04-09 03:16:30 +0000 Processing by Spree::Admin::ImagesController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"4aJsmuFlEK2iWOD/UkJMR+yJxPFvV0id55RDOileygk=", "image"=>{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x0000000a062110 @original_filename="Organic Mayo.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"image[attachment]\"; filename=\"Organic Mayo.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20160409-24155-1jp1lwb>>, "viewable_id"=>"3469", "alt"=>""}, "button"=>"", "product_id"=>"organic-mayo-11-dot-25oz"} Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/Organic Mayo20160409-24155-1bexf3l.jpg[0]' [paperclip] An error was received while processing: # Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/Organic Mayo20160409-24155-1bexf3l.jpg[0]' [paperclip] An error was received while processing: # Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/Organic Mayo20160409-24155-1bexf3l.jpg[0]' [paperclip] An error was received while processing: # Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/Organic Mayo20160409-24155-1bexf3l.jpg[0]' [paperclip] An error was received while processing: # Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/Organic Mayo20160409-24155-1bexf3l.jpg[0]' Completed 500 Internal Server Error in 97.9ms

Paperclip::Errors::NotIdentifiedByImageMagickError (Paperclip::Errors::NotIdentifiedByImageMagickError): paperclip (3.4.2) lib/paperclip/geometry_detector_factory.rb:10:in make' paperclip (3.4.2) lib/paperclip/geometry.rb:26:infrom_file' /home/deploy/.bundler/omg_production/ruby/1.9.1/bundler/gems/spree-38b14a9cdd9a/core/app/models/spree/image.rb:37:in find_dimensions' activesupport (3.2.21) lib/active_support/callbacks.rb:405:in_run50318027698665127post_process1565033324612751986callbacks' activesupport (3.2.21) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.21) lib/active_support/callbacks.rb:385:in_run_post_process_callbacks' activesupport (3.2.21) lib/active_support/callbacks.rb:81:in run_callbacks' paperclip (3.4.2) lib/paperclip/callbacks.rb:26:inrun_paperclip_callbacks' paperclip (3.4.2) lib/paperclip/attachment.rb:420:in post_process' paperclip (3.4.2) lib/paperclip/attachment.rb:108:inassign' paperclip (3.4.2) lib/paperclip.rb:199:in block in has_attached_file' activerecord (3.2.21) lib/active_record/attribute_assignment.rb:85:inblock in assign_attributes' activerecord (3.2.21) lib/active_record/attribute_assignment.rb:78:in each' activerecord (3.2.21) lib/active_record/attribute_assignment.rb:78:inassign_attributes' activerecord (3.2.21) lib/active_record/attribute_assignment.rb:36:in attributes=' /home/deploy/.bundler/omg_production/ruby/1.9.1/bundler/gems/spree-38b14a9cdd9a/backend/app/controllers/spree/admin/resource_controller.rb:46:increate' actionpack (3.2.21) lib/action_controller/metal/implicit_render.rb:4:in send_action' actionpack (3.2.21) lib/abstract_controller/base.rb:167:inprocess_action' actionpack (3.2.21) lib/action_controller/metal/rendering.rb:10:in process_action' actionpack (3.2.21) lib/abstract_controller/callbacks.rb:18:inblock in process_action' activesupport (3.2.21) lib/active_support/callbacks.rb:557:in _run__895434812718083706__process_action__2000433375297806937__callbacks' activesupport (3.2.21) lib/active_support/callbacks.rb:405:inrun_callback' activesupport (3.2.21) lib/active_support/callbacks.rb:385:in _run_process_action_callbacks' activesupport (3.2.21) lib/active_support/callbacks.rb:81:inrun_callbacks' actionpack (3.2.21) lib/abstract_controller/callbacks.rb:17:in process_action' actionpack (3.2.21) lib/action_controller/metal/rescue.rb:29:inprocess_action' actionpack (3.2.21) lib/action_controller/metal/instrumentation.rb:30:in block in process_action' activesupport (3.2.21) lib/active_support/notifications.rb:123:inblock in instrument' activesupport (3.2.21) lib/active_support/notifications/instrumenter.rb:20:in instrument' activesupport (3.2.21) lib/active_support/notifications.rb:123:ininstrument' actionpack (3.2.21) lib/action_controller/metal/instrumentation.rb:29:in process_action' actionpack (3.2.21) lib/action_controller/metal/params_wrapper.rb:207:inprocess_action' activerecord (3.2.21) lib/active_record/railties/controller_runtime.rb:18:in process_action' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:32:inblock in process_action' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:365:in perform_action_with_newrelic_trace' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:31:inprocess_action' actionpack (3.2.21) lib/abstract_controller/base.rb:121:in process' actionpack (3.2.21) lib/abstract_controller/rendering.rb:45:inprocess' actionpack (3.2.21) lib/action_controller/metal.rb:203:in dispatch' actionpack (3.2.21) lib/action_controller/metal/rack_delegation.rb:14:indispatch' actionpack (3.2.21) lib/action_controller/metal.rb:246:in block in action' actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:73:incall' actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:73:in dispatch' actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:36:incall' journey (1.0.4) lib/journey/router.rb:68:in block in call' journey (1.0.4) lib/journey/router.rb:56:ineach' journey (1.0.4) lib/journey/router.rb:56:in call' actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:608:incall' railties (3.2.21) lib/rails/engine.rb:484:in call' railties (3.2.21) lib/rails/railtie/configurable.rb:30:inmethod_missing' journey (1.0.4) lib/journey/router.rb:68:in block in call' journey (1.0.4) lib/journey/router.rb:56:ineach' journey (1.0.4) lib/journey/router.rb:56:in call' actionpack (3.2.21) lib/action_dispatch/routing/route_set.rb:608:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' newrelic_rpm (3.9.3.241) lib/new_relic/rack/error_collector.rb:50:intraced_call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:55:in call' newrelic_rpm (3.9.3.241) lib/new_relic/rack/agent_hooks.rb:26:intraced_call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:55:in call' newrelic_rpm (3.9.3.241) lib/new_relic/rack/browser_monitoring.rb:23:intraced_call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:55:in call' warden (1.2.3) lib/warden/manager.rb:35:inblock in call' warden (1.2.3) lib/warden/manager.rb:34:in catch' warden (1.2.3) lib/warden/manager.rb:34:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (3.2.21) lib/action_dispatch/middleware/best_standards_support.rb:17:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' rack (1.4.5) lib/rack/etag.rb:23:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' rack (1.4.5) lib/rack/conditionalget.rb:35:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (3.2.21) lib/action_dispatch/middleware/head.rb:14:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (3.2.21) lib/action_dispatch/middleware/params_parser.rb:21:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (3.2.21) lib/action_dispatch/middleware/flash.rb:242:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' rack (1.4.5) lib/rack/session/abstract/id.rb:210:incontext' rack (1.4.5) lib/rack/session/abstract/id.rb:205:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' actionpack (3.2.21) lib/action_dispatch/middleware/cookies.rb:341:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' activerecord (3.2.21) lib/active_record/query_cache.rb:64:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' activerecord (3.2.21) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' actionpack (3.2.21) lib/action_dispatch/middleware/callbacks.rb:28:in block in call' activesupport (3.2.21) lib/active_support/callbacks.rb:405:in_run1776711306456020621call1565033324612751986__callbacks' activesupport (3.2.21) lib/active_support/callbacks.rb:405:in __run_callback' activesupport (3.2.21) lib/active_support/callbacks.rb:385:in_run_call_callbacks' activesupport (3.2.21) lib/active_support/callbacks.rb:81:in run_callbacks' actionpack (3.2.21) lib/action_dispatch/middleware/callbacks.rb:27:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (3.2.21) lib/action_dispatch/middleware/remote_ip.rb:31:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (3.2.21) lib/action_dispatch/middleware/debug_exceptions.rb:16:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' actionpack (3.2.21) lib/action_dispatch/middleware/show_exceptions.rb:56:incall' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:in call' railties (3.2.21) lib/rails/rack/logger.rb:32:incall_app' railties (3.2.21) lib/rails/rack/logger.rb:16:in block in call' activesupport (3.2.21) lib/active_support/tagged_logging.rb:22:intagged' railties (3.2.21) lib/rails/rack/logger.rb:16:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' actionpack (3.2.21) lib/action_dispatch/middleware/request_id.rb:22:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' rack (1.4.5) lib/rack/methodoverride.rb:21:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' rack (1.4.5) lib/rack/runtime.rb:17:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' activesupport (3.2.21) lib/active_support/cache/strategy/local_cache.rb:72:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' rack (1.4.5) lib/rack/lock.rb:15:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' actionpack (3.2.21) lib/action_dispatch/middleware/static.rb:83:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' rack-cache (1.2) lib/rack/cache/context.rb:136:in forward' rack-cache (1.2) lib/rack/cache/context.rb:143:inpass' rack-cache (1.2) lib/rack/cache/context.rb:155:in invalidate' rack-cache (1.2) lib/rack/cache/context.rb:71:incall!' rack-cache (1.2) lib/rack/cache/context.rb:51:in call' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' railties (3.2.21) lib/rails/engine.rb:484:in call' railties (3.2.21) lib/rails/application.rb:231:incall' railties (3.2.21) lib/rails/railtie/configurable.rb:30:in method_missing' newrelic_rpm (3.9.3.241) lib/new_relic/agent/instrumentation/middleware_tracing.rb:57:incall' unicorn (4.9.0) lib/unicorn/http_server.rb:580:in process_client' unicorn (4.9.0) lib/unicorn/http_server.rb:674:inworker_loop' unicorn (4.9.0) lib/unicorn/http_server.rb:529:in spawn_missing_workers' unicorn (4.9.0) lib/unicorn/http_server.rb:140:instart' unicorn (4.9.0) bin/unicorn_rails:209:in <top (required)>' /home/deploy/.bundler/omg_production/ruby/1.9.1/bin/unicorn_rails:23:inload' /home/deploy/.bundler/omg_production/ruby/1.9.1/bin/unicorn_rails:23:in <main>'

uninstalling imagemagick was not done to fix this issue. Replacing the image fixed it.

amitdotagarwal commented 8 years ago

Error is due to the syntax

OLD syntax was :styles => { :medium => "300x300>" } New syntax is style: { :medium => "300x300>" }

this works perfectly for me.

palya commented 8 years ago

Hi, I have the same issue. When i try to upload avatar for my user i get error: Avatar Paperclip::Errors::NotIdentifiedByImageMagickError, Avatar Paperclip::Errors::NotIdentifiedByImageMagickError, and Avatar Paperclip::Errors::NotIdentifiedByImageMagickError

Identify works as expected and shows:

2.jpg JPEG 200x200 200x200+0+0 8-bit sRGB 10.8KB 0.000u 0:00.000

I tried a lot of, but it still doesn't work.

Mac OSX 10.11.5 ImageMagick 6.9.4-7 ruby 2.3.1p112 rails 4.2.5.1 paperclip (4.3.6)

alpracka commented 8 years ago

Update ImageMagick to 6.9.4-8 (I expect u are using homebrew) - I had the same issue and it is gone now. Seems on bug in 6.9.4-7 but I can't find info about it.

palya commented 8 years ago

I've reinstalled ImageMagick using 'Install from Unix Source' guide and it works nicely now.

sribalakumar commented 8 years ago

Mac OSX 10.11.4 and used brew ? This should solve the issue:

brew uninstall imagemagick
brew update
brew install imagemagick

Updating ImageMagick to 6.9.4-8 solves the issue.

cooltk commented 8 years ago

For windows, i had the same issue. And same solution, i reinstalled Imagemagick and it works well now.

ianwdunlop commented 8 years ago

I had the same issue recently on ubuntu 14.04. Installing libmagickwand-dev seemed to sort it out.

marquescharlon commented 8 years ago

I tested here and it worked. I installed version ImageMagick-6.9.4-8-Q16-HDRI-x64-dll. Thanks! To download: ImageMagick-6.9.4-8-Q16-HDRI-x64-dll

JhoanLT commented 8 years ago

Thanks @Marcquescharlon has worked for me.! Thank you

JhoanLT commented 8 years ago

Este error Paperclip::Errors::NotIdentifiedByImageMagickError lo he solucionado gracias al aporte de Marquescharlon.! Lo solucionan descargando la versión ImageMagick-6.9.4-8-Q16-HDRI-x64-dll.exe de la siguiente página: http://ftp.icm.edu.pl/packages/ImageMagick/binaries/ Yo realiaze dos cosas la primera fue descargarme el archivo de ImageMagick y la segunda fue al momento de instalar donde nos indica la ruta que se va agregar al path quite la que trae por defecto el programa y puse C:/ImageMagick esto debido a una recomendación de que la ruta del path es mejor dejarla sin espacios.!

codeinaire commented 7 years ago

I got this error: Paperclip::Errors::NotIdentifiedByImageMagickError when using Paperclip 5.0 on Rails 5.0.

The solutions I tried were:

What worked was going into models/photo.rb and changing this: has_attached_file :image#, styles: { :medium => "300x300>", :thumb => "100x100>" } to this: has_attached_file :image.

Now I can upload photos.

PedroPauloML commented 7 years ago

Thanks for your solution. @amitdotagarwal, but when I do this paperclip don't generate two cropped images, but just one.

Anybody can help us?

luisgrases commented 7 years ago

I believe @amitdotagarwal's solution isn't quite right, I couldn't find on the documentation the new syntax he is talking about. So I believe that solution has the same effect of removing the styles option.

For people who still want to have the file on different sizes, keep using the styles sintax and try to: brew update brew upgrade brew install ghostscript

that worked for me.

marquescharlon commented 7 years ago

Hi! @PedroPauloML

Take a look at this example: "has_attached_file" and "validates_attachment"

Have a nice weekend!

andrewcockerham commented 7 years ago
brew update
brew upgrade

worked for me

Xavier-IV commented 7 years ago

For WINDOWS user

Most of the answer is for MacOS. For those using Windows. Long story short, Rails cannot detect where is your 'identify'., use this step:

Uninstall your magick, and re-install again BUT!

  1. Be sure to tick ALL when there is an option to do so, if not, Magick will not install the package identify.
  2. Confirm that Magick and Identify is working by running:

    $ magick $ identify

If you don't know where the file is located, simply run $ which identify. Take note of the path, usually:

C:\Program Files\ImageMagick-7.0.6-Q16

In your Rails, create an initializers for Paperclip, and paste this code:

app/config/initializers/paperclip.rb

Paperclip.options[:command_path] = "C:\\Program Files\\ImageMagick-7.0.6-Q16"

Note the double back-slash ( \ )

  1. Restart your server

Footnote: This steps allows me to use the styles: tag that others comments are discarding.

  # Your model.
  has_attached_file :image, styles: {
      thumb: '100x100>',
      square: '200x200#',
      medium: '300x300>'
  }

  validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
        <% @posts.each do |post| %>
             <%= post.title %>
              <!-- Note that in the MODEL we use 'medium', here we must also use 'medium' or
                      any others (thumb, square) -->
              <%= image_tag post.image.url(:medium) %>
        <% end %>
dominiccodes commented 7 years ago

I'm a Windows 7 user. Changing the syntax from the old to the new fixed this for me. I got the syntax from amitdotagarwal's post above. (the one with all the likes!)

My syntax in app\models\post.rb was

has_attached_file :image, styles: { medium: "300x300>", thumb: "100x100>" }

which I changed to

has_attached_file :image, style: { :medium => "300x300>", :thumb => "100x100>" }

Hope this helps!

nik-kg commented 7 years ago

If nothing helps

For windows, check this while installing:

1

bchellingworth commented 7 years ago

Changing styles: to style: is not fixing the issue, you are just bypassing the styles altogether to avoid the probelm. You might aswell change styles to foobar and it will do the same thing

sebastian-palma commented 7 years ago

As @andrewcockerham

$ brew update
$ brew upgrade

did the trick.

ymmtshny commented 6 years ago

I got Paperclip::Errors::NotIdentifiedByImageMagickError

$ brew upgrade imagemagick

solves the error

arthurnn commented 6 years ago

For me the error was happening because I was missing ghostscript integration with imagemagick. That was happening because I was using ruby Docker image which already had imagemagick installed without GS. To fix the issue, I did the following in my docker file:

# install imagemagick with libgs
RUN apt-get update -qq && apt-get install -y \
  ghostscript \
  libgs-dev \
  imagemagick

Maybe this error should identify if GS is missing and a type pdf file is trying to be converted, and give a better error message.

bbugh commented 6 years ago

Not sure why this spontaneously broke after working fine for ages, but @ymmtshny's solution to upgrade imagemagick worked for me.

I don't suggest that you do what @vnhnhm suggested, because that will upgrade all of your brew packages.

YarikST commented 6 years ago

Installing libmagickwand-dev seemed to sort it out.

1.sudo apt autoremove imagemagick 2.rm /usr/bin/convert and rm /usr/bin/convert-im6 3.sudo apt-get install imagemagick 4.sudo apt-get install libmagickwand-dev

nageswararao-nyros commented 5 years ago

Sir/Madam is it possible to upload pdf document using with paperclip? I am getting error An error was received while processing: # I have one upload field in my view, i want to upload both images and documents with that field. Can you send me the code or any Suggestions .........Thankyou all

ohiodn8 commented 5 years ago

Yes, it is possible to attach pdf with paperclip. Its been a while, but your model.rb should look something like:


has_attached_file :document, styles: {
        thumb: '100x100>',
        square: '200x200#',
        medium: '350x350>',
        pdf_preview: '600x600>'}, processors: [:thumbnail]
  validates_attachment :document, :content_type => {:content_type => %w(image/jpeg image/jpg image/png application/pdf application/msword application/vnd.openxmlformats-officedocument.wordprocessingml.document)},
  attachment_size: { less_than: 5.megabytes }
  has_attached_file :document

You can't upload multiple files with one upload field. To accomplish that, you may want to consider using DropZone.js with paperclip.

nageswararao-nyros commented 5 years ago

Thank you So much Sir