* 환경

bitnami 레드마인 설치 : https://bitnami.com/stack/redmine/installer : Redmine 3.2.0-2

redmine_ckeditor 1.1.3 설치 

설치된 버전 정보

Environment:

 Redmine version                3.2.0.stable

 Ruby version                   2.0.0-p647 (2015-08-18) [i386-mingw32]

 Rails version                  4.2.5

 Environment                    production

 Database adapter               Mysql2


* 증상

ckeditor 업로드 버튼 클릭시 에러 발생 (Browse and Upload images)

javascript alert 창 에러 내용>>

      "Could not upload your file:- rich_file There was an error processing the thumbnail for c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah"


서버 로그(production.log) 에러 내용 >>

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

Started GET "/redmine/rich/files/?CKEditor=news_description&CKEditorFuncNum=2&default_style=original&allowed_styles=thumb%2Crich_thumb%2Coriginal&insert_many=false&type=image&scoped=true&scope_type=Project&scope_id=1&viewMode=grid" for 127.0.0.1 at 2016-03-10 18:45:51 +0900

Processing by Rich::FilesController#index as HTML

  Parameters: {"CKEditor"=>"news_description", "CKEditorFuncNum"=>"2", "default_style"=>"original", "allowed_styles"=>"thumb,rich_thumb,original", "insert_many"=>"false", "type"=>"image", "scoped"=>"true", "scope_type"=>"Project", "scope_id"=>"1", "viewMode"=>"grid"}

  Current user: admin (id=1)

  Rendered plugins/redmine_ckeditor/app/views/rich/files/_file.html.erb (2.0ms)

  Rendered E:/redmine/redmine-3.2.0-2/ruby/lib/ruby/gems/2.1.0/bundler/gems/rich-93d1dd9526e1/app/views/rich/files/index.html.erb within layouts/rich/application (8.0ms)

Completed 200 OK in 75ms (Views: 18.0ms | ActiveRecord: 44.0ms)

Started POST "/redmine/rich/files?authenticity_token=SiB9ZatBvvvuW4RSb3rmVjHn4aLT0Urr20iVPWdJpvnwgca0oecvZabO5TwHyckQtU130TIiNw%2B3i4cSbYCCqw%3D%3D&simplified_type=image&scoped=true&scope_type=Project&scope_id=1&qqfile=2.gif" for 127.0.0.1 at 2016-03-10 18:45:53 +0900

Processing by Rich::FilesController#create as */*

  Parameters: {"file"=>#<ActionDispatch::Http::UploadedFile:0x4bcd068 @tempfile=#<Tempfile:C:/Windows/Temp/raw-upload.20160310-7000-145a7yg>, @original_filename="2.gif", @content_type="application/octet-stream", @headers=nil>, "authenticity_token"=>"SiB9ZatBvvvuW4RSb3rmVjHn4aLT0Urr20iVPWdJpvnwgca0oecvZabO5TwHyckQtU130TIiNw+3i4cSbYCCqw==", "simplified_type"=>"image", "scoped"=>"true", "scope_type"=>"Project", "scope_id"=>"1", "qqfile"=>"2.gif"}

  Current user: admin (id=1)

Command :: identify -format '%wx%h,%[exif:orientation]' "C:/Windows/Temp/c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah.gif[0]" 2>NUL

Command :: identify -format %m "C:/Windows/Temp/c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah.gif[0]"

Command :: convert "C:/Windows/Temp/c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah.gif" -coalesce -auto-orient -resize "100x" -crop "100x100+0+0" +repage -layers "optimize" "C:/Windows/Temp/c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah20160310-7000-16remft"

[paperclip] An error was received while processing: #<Paperclip::Error: There was an error processing the thumbnail for c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah>

Command :: identify -format '%wx%h,%[exif:orientation]' "C:/Windows/Temp/c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah.gif[0]" 2>NUL

Command :: identify -format %m "C:/Windows/Temp/c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah.gif[0]"

Command :: convert "C:/Windows/Temp/c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah.gif" -coalesce -auto-orient -resize "100x" -crop "100x100+0+0" +repage -layers "optimize" "C:/Windows/Temp/c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah20160310-7000-zjm689"

[paperclip] An error was received while processing: #<Paperclip::Error: There was an error processing the thumbnail for c81e728d9d4c2f636f067f89cc14862c20160310-7000-6mxbah>

Completed 200 OK in 236ms (Views: 0.0ms | ActiveRecord: 34.0ms)


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


- bitnami redmine 설치하면 redmineThin1,2 라는 윈도우 서비스로 설치되는데 이떄 서비스 계정이 Local System(로컬 시스템 계정)으로 설치됨.


- ckeditor는 파일 업로드시 썸네일 이미지(thumbnail) 를 생성하기 위해 imagemagick 를 사용하는데

이때 업로드 받은 파일을 C:\Windows\Temp에 두고 identity, convert 명령을 통해 생성함.

이때 문제 발생하여 실패.





* 해결 방법

1. 환경 변수 추가

- Path에 C:\redmine\redmine-3.2.0-2\imagemagick 추가

- MAGICK_CODER_MODULE_PATH 키 생성 및 C:\redmine\redmine-3.2.0-2\imagemagick 추가


2. redmineThin1, 2 윈도우 서비스 속성 "로그온 탭" 에서 "계정 지정(T)" 을 Local Service 로 변경(암호, 암호확인은 공백 입력하면됨.)

혹은 AD에 엮여서 관리되는 서버면 administrator 권한 있는 계정으로 해도 됨.

(이러면 사용하는 Temp 폴더가 Local System 이었을떈 C:\Windows\Temp 에서 C:/Windows/SERVIC~2/LOCALS~1/AppData/Local/Temp 로 변경됨)

3. 서비스 재시작