When using CKEditor + Paperclip on rails 3 I get this error message when uploading an image via the wysiwyg editor:
Started POST "/ckeditor/pictures?CKEditor=question%5Banswers_attributes%5D%5B0%5D_body_editor&CKEditorFuncNum=2&langCode=en" for 127.0.0.1 at 2011-06-11 18:11:58 -0500
Processing by Ckeditor::PicturesController#create as HTML
Parameters: {"upload"=>#>, "CKEditor"=>"question[answers_attributes][0]_body_editor", "CKEditorFuncNum"=>"2", "langCode"=>"en"}
[paperclip] identify -format %wx%h '/var/folders/11/114evplqEWuTFgn6byOUQE+++TI/-Tmp-/stream20110611-1900-1hpvz8i.gif[0]' 2>/dev/null
[paperclip] An error was received while processing: #
[paperclip] identify -format %wx%h '/var/folders/11/114evplqEWuTFgn6byOUQE+++TI/-Tmp-/stream20110611-1900-1hpvz8i.gif[0]' 2>/dev/null
[paperclip] An error was received while processing: #
User Load (1.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 ORDER BY last_name ASC LIMIT 1
Rendered text template (0.0ms)
Completed 200 OK in 214ms (Views: 0.9ms | ActiveRecord: 1.2ms)
Is this a error with paperclip or?
Is identify installed (image magick) and in the PATH for your application?
(posting so question doesn't appear in unanswered list)
Edit: Forgot to mention this might need to go in environments/*.rb:
Paperclip.options[:command_path] = "/usr/local/bin" # or path to wherever identify is located.
Related
I'm just starting with Solidus, though I do know my way around Rails. I've created a Solidus project on my Mac, and I installed all the required gems as well as ImageMagick through Homebrew. Both identify and magick work as terminal commands as my /usr/local/bin directory is in my PATH. I've also specified the path to identify in the application.rb file (I'm guessing it's supposed to go in side the Application class). However, none of the images show up in Solidus, and when I try and manually add an image, I get the following error (it's related to paperclip). Any help here would be - Google has not been my friend this time. The error message is shown below:
[paperclip] Trying to link /tmp/RackMultipart20200622-9041-8gndhx.jpg to /tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1t35lnu.jpg
[paperclip] Trying to link /tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1t35lnu.jpg to /tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-62aumc.jpg
Command :: PATH=/usr/local/bin/identify:$PATH; file -b --mime '/tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-62aumc.jpg'
Command :: PATH=/usr/local/bin/identify:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1t35lnu.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: PATH=/usr/local/bin/identify:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1t35lnu.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: PATH=/usr/local/bin/identify:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1t35lnu.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
Command :: PATH=/usr/local/bin/identify:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1t35lnu.jpg[0]' 2>/dev/null
[paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError>
[paperclip] Trying to link /tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1t35lnu.jpg to /tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1dlkgdw.jpg
Command :: PATH=/usr/local/bin/identify:$PATH; file -b --mime '/tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1dlkgdw.jpg'
[paperclip] Trying to link /tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-1t35lnu.jpg to /tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-16yjulo.jpg
Command :: PATH=/usr/local/bin/identify:$PATH; file -b --mime '/tmp/cdcf58ad03be2998ea64da8e6cd3e43c20200622-9041-16yjulo.jpg'
Rendering /Library/Ruby/Gems/2.6.0/gems/solidus_backend-2.10.1/app/views/spree/admin/images/create.js.erb
Rendered /Library/Ruby/Gems/2.6.0/gems/solidus_backend-2.10.1/app/views/spree/admin/images/create.js.erb (Duration: 3.4ms | Allocations: 874)
Completed 200 OK in 836ms (Views: 20.7ms | ActiveRecord: 7.6ms | Allocations: 29100)
I run my rails application locally and everything is perfect. But running in a nginx server I get this error:
User Load (0.2ms) SELECT users.* FROM users WHERE users.id = 15482 ORDER BY users.id ASC LIMIT 1
App 12917 stderr: Artist Load (0.1ms) SELECT users.* FROM users WHERE users.type IN ('Artist') AND users.id = 15482 LIMIT 1
App 12917 stderr: (0.3ms) BEGIN
App 12917 stderr: Command :: PATH=/usr/local/bin:$PATH; file -b --mime '/tmp/c705bd2b503af7c522d45bc0f1bb849720170623-12978-t8220f.jpeg'
App 12917 stderr: [paperclip] Content Type Spoof: Filename boxImg22.jpeg (image/jpeg from Headers, ["image/jpeg"] from Extension), content type discovered from file command: . See documentation to allow this combination.
App 12917 stderr: User Exists (4.2ms) SELECT 1 AS one FROM users WHERE users.email = BINARY 'manfe#gmail.com' AND (users.id != 15482) LIMIT 1
App 12917 stderr: (0.6ms) ROLLBACK
It does not me allow to upload any file with paperclip ( images and pdf ).
Thanks in advance
I resolved. I uninstall ImageMagick. ( it was installed with wget, tar, make and so on ). And installed with apt-get install imagemagick
I'm trying to create a very simple program which upload image to the database using Paperclip in ROR. But the image can't go to the database everytime I press SUBMIT. Can anyone please point me where I did wrong.
This is my LOG File
Started POST "/users" for 127.0.0.1 at 2017-03-22 21:03:03 +1000
Processing by UsersController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"P1JjsD8GMBJbrAnOnc/RtTDDuVOCiv/z
sMhvM0Lzb3+bELWElYYN3FAVgERADmv8E1+dXK5nDais+LmmwaCa4Q==", "user"=>{"title"=>"eeee"
, "avatar"=>#<ActionDispatch::Http::UploadedFile:0xa40e398 #tempfile=#<Tempfile:C:/
Users/GaryVLC/AppData/Local/Temp/RackMultipart20170322-15228-psq6nh.jpg>, #original
_filename="14563434_519556131584166_3038665901337502288_n.jpg", #content_type="imag
e/jpeg", #headers="Content-Disposition: form-data; name=\"user[avatar]\"; filename=
\"14563434_519556131584166_3038665901337502288_n.jpg\"\r\nContent-Type: image/jpeg\
r\n">}, "commit"=>"Submit"}
Command :: file -b --mime "C:/Users/GaryVLC/AppData/Local/Temp/4233aadfd0ba434db17d
ee20d9613cee20170322-15228-tizi43.jpg"
[paperclip] Content Type Spoof: Filename 14563434_519556131584166_30386659013375022
88_n.jpg (image/jpeg from Headers, ["image/jpeg"] from Extension), content type dis
covered from file command: . See documentation to allow this combination.
(0.0ms) begin transaction
Command :: file -b --mime "C:/Users/GaryVLC/AppData/Local/Temp/4233aadfd0ba434db17d
ee20d9613cee20170322-15228-qcbjc3.jpg"
[paperclip] Content Type Spoof: Filename 14563434_519556131584166_30386659013375022
88_n.jpg (image/jpeg from Headers, ["image/jpeg"] from Extension), content type dis
covered from file command: . See documentation to allow this combination.
Command :: file -b --mime "C:/Users/GaryVLC/AppData/Local/Temp/4233aadfd0ba434db17d
ee20d9613cee20170322-15228-1l2s8em.jpg"
[paperclip] Content Type Spoof: Filename 14563434_519556131584166_30386659013375022
88_n.jpg (image/jpeg from Headers, ["image/jpeg"] from Extension), content type dis
covered from file command: . See documentation to allow this combination.
(0.0ms) rollback transaction
Rendering users/new.html.erb within layouts/application
Rendered users/new.html.erb within layouts/application (1.0ms)
Completed 200 OK in 108ms (Views: 53.3ms | ActiveRecord: 0.0ms)
I'm using Paperclip with ActiveAdmin to upload pictures in Articles.
But I have a problem, when I'm editing an existing article, the first time after Webrcik started, it functions very well. But systematically, the second time I try to edit an article (whatever the one) Windows tells me that "file.exe" stopped to function, and " Internal Server Error Invalid argument - STDOUT " appears in the browser.
So, I restart webrick, and upload works only one time etc...
Here's the log :
Started PUT "/admin/articles/1" for 127.0.0.1 at 2012-10-24 18:11:45 +0200
Processing by Admin::ArticlesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"VaB3lx3UZaOjUA6Yh+h8jG7ZExSQZDiyZUw6GYJQPbY=", "article"=>{"title"=>"ee", "desc"=>"ee", "content"=>"eeee", "photo"=>#<ActionDispatch::Http::UploadedFile:0x3cce7f0 #original_filename="Desert.jpg", #content_type="image/jpeg", #headers="Content-Disposition: form-data; name=\"article[photo]\"; filename=\"Desert.jpg\"\r\nContent-Type: image/jpeg\r\n", #tempfile=#<File:C:/Users/Greg/AppData/Local/Temp/RackMultipart20121024-6620-oorxwu>>}, "commit"=>"Update Article", "id"=>"1"}
[1m[35mAdminUser Load (0.0ms)[0m SELECT `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 2 LIMIT 1
[1m[36mArticle Load (1.0ms)[0m [1mSELECT `articles`.* FROM `articles` WHERE `articles`.`id` = ? LIMIT 1[0m [["id", "1"]]
Command :: identify -format %wx%h "C:/Users/Greg/AppData/Local/Temp/Desert20121024-6620-16n1ehl.jpg[0]"
Command :: identify -format %m "C:/Users/Greg/AppData/Local/Temp/Desert20121024-6620-16n1ehl.jpg[0]"
Command :: identify -format %m "C:/Users/Greg/AppData/Local/Temp/Desert20121024-6620-16n1ehl.jpg[0]"
Command :: convert "C:/Users/Greg/AppData/Local/Temp/Desert20121024-6620-16n1ehl.jpg[0]" -auto-orient -resize "510x" -crop "510x350+0+16" +repage "C:/Users/Greg/AppData/Local/Temp/Desert20121024-6620-16n1ehl20121024-6620-mvfl3a"
Command :: file -b --mime "C:/Users/Greg/AppData/Local/Temp/Desert20121024-6620-16n1ehl20121024-6620-mvfl3a"
[paperclip] Error while determining content type: Command 'file -b --mime :file' returned 255. Expected 0
Command :: identify -format %wx%h "C:/Users/Greg/AppData/Local/Temp/Desert20121024-6620-16n1ehl.jpg[0]"
Command :: identify -format %m "C:/Users/Greg/AppData/Local/Temp/Desert20121024-6620-16n1ehl.jpg[0]"
Completed 500 Internal Server Error in 22073ms
Errno::EINVAL (Invalid argument - ruby_setenv):
I've been searching for a solution...but I did not find one.
Does someone have an idea of the source of the problem ?
The 'file' program isn't a part of Windows, which suggests you installed it (or something that includes it) to get this far - any idea what that was? Gnu provides a Windows version of 'file' as part of GnuWin32.
Learning more about your copy of that program will probably be the first step to fixing your problem. (Hope this helps.)
How can I find out more about that error?
This is what's shown in the log:
Processing TrendsController#update (for 127.0.0.1 at 2011-01-04 17:24:18) [PUT] Parameters: {"commit"=>"Update", "authenticity_token"=>"WZpPerl3dV+edWXhxLiBlNfv3KTFb0fNLVkhF3ZMNXA=", "id"=>"1", "trend"=>{"title"=>"bluiz", "description"=>"uzgz", "image"=>#}}
[paperclip] identify -format %wx%h "C:/Windows/Temp/stream20110104-3660-1j1ap8i-0.jpg[0]" 2>NUL
[paperclip] convert "C:/Windows/Temp/stream20110104-3660-1j1ap8i-0.jpg[0]" -resize "100x140>" "C:/Windows/Temp/stream20110104-3660-1j1ap8i-020110104-3660-rmkivh-0" 2>NUL
[paperclip] An error was received while processing: #
I had to put the PATH-entries for ImageMagick and FFMPEG before system32 in the environment-variables, because it tried to use Windows' own convert-command.