我使用rails 5.0.1与gem' ckeditor',github:' galetahub / ckeditor'。
上传图片时在本地运行:
Started POST "/ckeditor/pictures?CKEditor=blog_content&CKEditorFuncNum=1&langCode=en" for 127.0.0.1 at 2017-08-25 13:42:46 +0200
Processing by Ckeditor::PicturesController#create as HTML
Parameters: {"upload"=>#<ActionDispatch::Http::UploadedFile:0x007fdbb2751418 @tempfile=#<Tempfile:/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/RackMultipart20170825-15213-h6z3o4.jpg>, @original_filename="Celina.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"upload\"; filename=\"Celina.jpg\"\r\nContent-Type: image/jpeg\r\n">, "ckCsrfToken"=>"KWW95qRoTkkliU37ytqWhxGEg0Qmlo2BlMa3jhY0", "CKEditor"=>"blog_content", "CKEditorFuncNum"=>"1", "langCode"=>"en"}
Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' 2>/dev/null
Command :: PATH=/usr/bin/:$PATH; identify -format %m '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]'
Command :: PATH=/usr/bin/:$PATH; convert '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' -auto-orient -resize "800>" '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/81df6ad10e023d4b1d778924afca264320170825-15213-191pjjb'
Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' 2>/dev/null
Command :: PATH=/usr/bin/:$PATH; identify -format %m '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]'
Command :: PATH=/usr/bin/:$PATH; convert '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' -auto-orient -resize "x100" -crop "118x100+8+0" +repage '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/81df6ad10e023d4b1d778924afca264320170825-15213-4zjjfu'
(0.4ms) BEGIN
Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/var/folders/ct/h7f4s97j5g5_8kt74w7z9j7w0000gn/T/9a373c13873aa5b41008cdf6948f3c9a20170825-15213-10eo1d0.jpg[0]' 2>/dev/null
SQL (1.0ms) INSERT INTO "ckeditor_assets" ("data_file_name", "data_content_type", "data_file_size", "data_fingerprint", "type", "width", "height", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["data_file_name", "Celina.jpg"], ["data_content_type", "image/jpeg"], ["data_file_size", 20803], ["data_fingerprint", "64cabe13eace3919caf99ca7fc5ce98a"], ["type", "Ckeditor::Picture"], ["width", 300], ["height", 223], ["created_at", "2017-08-25 11:42:46.485116"], ["updated_at", "2017-08-25 11:42:46.485116"]]
(0.4ms) COMMIT
Rendering html template
Rendered html template (0.0ms)
Completed 200 OK in 212ms (Views: 2.4ms | ActiveRecord: 5.6ms)
但是当我在docker中运行项目而没有更改任何内容时,它会给我错误消息:数据内容类型无效。
web_1 | Started POST "/ckeditor/pictures?CKEditor=blog_content&CKEditorFuncNum=1&langCode=en" for xxx.xx.x.x at 2017-08-25 12:43:29 +0000
web_1 | Processing by Ckeditor::PicturesController#create as HTML
web_1 | Parameters: {"upload"=>#<ActionDispatch::Http::UploadedFile:0x000033deb977a8 @tempfile=#<Tempfile:/tmp/RackMultipart20170825-1-26b8ip.jpg>, @original_filename="Celina.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"upload\"; filename=\"Celina.jpg\"\r\nContent-Type: image/jpeg\r\n">, "ckCsrfToken"=>"KWW95qRoTkkliU37ytqWhxGEg0Qmlo2BlMa3jhY0", "CKEditor"=>"blog_content", "CKEditorFuncNum"=>"1", "langCode"=>"en"}
web_1 | Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' 2>/dev/null
web_1 | Command :: PATH=/usr/bin/:$PATH; identify -format %m '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]'
web_1 | Command :: PATH=/usr/bin/:$PATH; convert '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' -auto-orient -resize "800>" '/tmp/fdc33e93e3e5f5ae6778f9e43bf8b70620170825-1-wddlyh'
web_1 | Command :: PATH=/usr/bin/:$PATH; identify -format '%wx%h,%[exif:orientation]' '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' 2>/dev/null
web_1 | Command :: PATH=/usr/bin/:$PATH; identify -format %m '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]'
web_1 | Command :: PATH=/usr/bin/:$PATH; convert '/tmp/9a373c13873aa5b41008cdf6948f3c9a20170825-1-d4ds2v.jpg[0]' -auto-orient -resize "x100" -crop "118x100+8+0" +repage '/tmp/fdc33e93e3e5f5ae6778f9e43bf8b70620170825-1-sf9kaf'
web_1 | (0.2ms) BEGIN
web_1 | (0.2ms) ROLLBACK
web_1 | Rendering html template
web_1 | Rendered html template (0.0ms)
web_1 | Completed 200 OK in 259ms (Views: 8.9ms | ActiveRecord: 28.6ms)
有什么想法吗?感谢
[编辑]
Dockerfile
FROM ruby:2.3.3-alpine
ENV RAILS_ENV production
ENV RACK_ENV production
# Install dependencies
RUN apk update && \
apk upgrade && \
apk add --update --no-cache \
build-base \
imagemagick \
bash \
git \
nodejs \
tzdata \
libxml2-dev \
libxslt-dev \
postgresql-dev \
&& rm -rf /var/cache/apk/* \
&& bundle config build.nokogiri --use-system-libraries \
&& gem install bundler --no-ri --no-rdoc \
&& mkdir -p /usr/src/i2i
WORKDIR /usr/src/i2i
COPY Gemfile Gemfile
COPY Gemfile.lock Gemfile.lock
RUN bundle install --jobs 20 --retry 5 --without development test
ADD . /usr/src/i2i
# Precompile Rails assets
RUN bundle exec rake assets:precompile
答案 0 :(得分:1)
您可以尝试使用<div class='flex-container'>
<div class='flex-child'>
<div class='single-item'>
.
.
.
而不是ruby:2.3.3-alpine
。
问题是某些命令可能需要一些先决条件包,而alpine是一个非常小的图像,包可能不存在。
因此,您可以继续使用像ruby:2.3.3-jessie
这样更大,更资源丰富的图片,或者您可以找到依赖项并将其安装在ruby:2.3.3-jessie
上