gpt4 book ai didi

ruby-on-rails - 回形针,s3 上传失败但没有显示任何错误

转载 作者:行者123 更新时间:2023-12-04 05:50:19 25 4
gpt4 key购买 nike

我一直在寻找类似主题的解决方案,但我无法以某种方式让它工作。这是我的申请日志

Command :: identify -format %wx%h '/tmp/0120121215-31657-19vihny.jpg[0]'
Command :: convert '/tmp/0120121215-31657-19vihny.jpg[0]' -auto-orient -resize "32x32!" - background white -flatten +matte '/tmp/0120121215-31657-19vihny20121215-31657-58mm3a.png'
Command :: identify -format %wx%h '/tmp/0120121215-31657-19vihny.jpg[0]'
Command :: convert '/tmp/0120121215-31657-19vihny.jpg[0]' -auto-orient -resize "320x320!" -background white -flatten +matte '/tmp/0120121215-31657-19vihny20121215-31657-1n3fgl2.png'

[paperclip] Saving attachments.
[paperclip] saving images/:User/50cc0cfb0feea807f6000004/original.jpg
[paperclip] saving images/:User/50cc0cfb0feea807f6000004/small.png
[paperclip] saving images/:User/50cc0cfb0feea807f6000004/medium.png

Started POST "/photos" for 127.0.0.1 at 2012-12-15 12:39:07 +0700
Processing by PhotosController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"SSjceuOzRNQfJyUCki86mNBfuHsK0bh5qQmX4pBi7uk=", "photo"=>{"image"=>#<ActionDispatch::Http::UploadedFile:0xb27e0164 @original_filename="01.jpg", @content_type="image/jpeg", @headers="Content-Disposition: form-data; name=\"photo[image]\"; filename=\"01.jpg\"\r\nContent-Type: image/jpeg\r\n", @tempfile=#<File:/tmp/RackMultipart20121215-31657-9oqjbm>>, "description"=>"This is decscription"}, "commit"=>"Create Photo"}

MOPED: 127.0.0.1:27017 COMMAND database=admin command={:ismaster=>1} (0.7489ms)
MOPED: 127.0.0.1:27017 INSERT database=image12345_development collection=photos documents=[{"_id"=>"50cc0cfb0feea807f6000004", "image_file_name"=>"01.jpg", "image_content_type"=>"image/jpeg", "image_file_size"=>368812, "image_updated_at"=>2012-12-15 05:39:07 UTC, "description"=>"This is decscription"}] flags=[] (0.2658ms)

[AWS S3 200 8.971826 0 retries] put_object(:acl=>:public_read,:bucket_name=>"image12345",:content_length=>368812,:content_type=>"image/jpeg",:data=>Paperclip::UploadedFileAdapter: 01.jpg,:key=>"images/:User/50cc0cfb0feea807f6000004/original.jpg")

[AWS S3 200 0.214209 0 retries] put_object(:acl=>:public_read,:bucket_name=>"image12345",:content_length=>2763,:content_type=>"image/png",:data=>Paperclip::FileAdapter: 0120121215-31657-19vihny20121215-31657-58mm3a.png,:key=>"images/:User/50cc0cfb0feea807f6000004/small.png")

[AWS S3 200 3.498196 0 retries] put_object(:acl=>:public_read,:bucket_name=>"image12345",:content_length=>142791,:content_type=>"image/png",:data=>Paperclip::FileAdapter: 0120121215-31657-19vihny20121215-31657-1n3fgl2.png,:key=>"images/:User/50cc0cfb0feea807f6000004/medium.png")

Redirected to http://localhost:3000/photos/50cc0cfb0feea807f6000004
Completed 302 Found in 12992ms

我为用户使用设计

在我的gem文件中有

gem "mongoid-paperclip", :require => "mongoid_paperclip"
gem 'paperclip'
gem "aws-sdk"

在我的模型/photo.rb

has_mongoid_attached_file :image,
:path => ':attachment/:User/:id/:style.:extension',
:storage => :s3,
:s3_credentials => File.join(Rails.root, 'config', 's3.yml'), #s3.yml contain credentials
:styles => {
:small => ['32x32!', :png],
:medium => ['320x320!', :png, :jpg],

},
:convert_options => { :all => '-background white -flatten +matte' }
attr_accessible :image, :description

在我的表单中

<%= form_for(@photo , :html => {:multipart => true} ) do |f| %>
<div class="field">
<%= f.label :image %><br />
<%= f.file_field :image %>
</div>
<% end %>

我已经尝试过许多解决方案,例如 add form_helper :multipart,在我以前的应用程序中,这个模型和 gem 运行良好,我确信凭证是正确的。它只是告诉我这是一个成功的更新,但没有上传图像。我在哪里可以找到关于这个问题的错误?或者我可以使用的任何工具?我真的坚持这一点并希望通过它,而不是创建新的应用程序并希望好运。

最佳答案

前段时间已经找到解决方案,但忘记发布

这个问题是同样的问题 Rails 3 - Amazon S3 Paperclip EU Problem

当我看到一张图片已经上传时我明白了,只是我没有使用正确的地址来访问它们:)

关于ruby-on-rails - 回形针,s3 上传失败但没有显示任何错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13889949/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com