RefineryCMS 2.1.2 및 새우를 사용하고 있습니다. 나는 이미지가있는 속성을 가진 속성 엔진을 가지고 있습니다. 내가 노력하고 내가 개발 & 생산을 시도했습니다새우 자산 파이프 라인 이미지
ArgumentError (/system/images/W1siZiIsIjIwMTQvMDcvMTYvMTZfNTZfNDVfOTY3XzEuanBnIl1d/1.jpg not found):
prawn (1.1.0) lib/prawn/images.rb:145:in `verify_and_open_image'
prawn (1.1.0) lib/prawn/images.rb:79:in `build_image_object'
prawn (1.1.0) lib/prawn/images.rb:67:in `image'
vendor/extensions/properties/app/models/refinery/properties/property_pdf.rb:29:in `pictures'
vendor/extensions/properties/app/models/refinery/properties/property_pdf.rb:9:in `initialize'
vendor/extensions/properties/app/controllers/refinery/properties/properties_controller.rb:23:in `new'
vendor/extensions/properties/app/controllers/refinery/properties/properties_controller.rb:23:in `block (2 levels) in show'
actionpack (3.2.18) lib/action_controller/metal/mime_responds.rb:196:in `call'
actionpack (3.2.18) lib/action_controller/metal/mime_responds.rb:196:in `respond_to'
vendor/extensions/properties/app/controllers/refinery/properties/properties_controller.rb:20:in `show'
actionpack (3.2.18) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.18) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.18) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.18) lib/active_support/callbacks.rb:447:in `_run__945948839670585827__process_action__3030439923241519075__callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.18) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.18) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.18) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.18) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.18) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.18) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.18) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.8.1.221) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:38:in `block in process_action'
newrelic_rpm (3.8.1.221) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:357:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.8.1.221) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:37:in
이 오류를 얻을 수 있도록
class Refinery::Properties::PropertyPdf < Prawn::Document
def initialize(property)
super()
image @property.property_images.first.image.url, fit: [300,300]
end
end
같은 사진과 함께 내 PDF 파일을 만들 때 나는 image_fu
를 사용하여 쇼 템플릿에 다음을 표시 할 수 있지만, 모드에서 내 컴퓨터에 모두 동일한 문제가 있습니다. 내가 http://localhost:3000/system/images/W1siZiIsIjIwMTQvMDcvMTYvMTZfNTZfNDVfOTY3XzEuanBnIl1d/1.jpg
보면 나는 다음과 같은 단지 개발 모드에서 작동 사용하는 경우 나는
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = true
# Generate digests for assets URLs
config.assets.digest = true
다음 한 이미지를 내 production.rb에서
을 볼 수 있습니다. RefineryCMS가 저장 이미지
그것은 아마존 S3 스토리지 이야기 '안개'를 사용https://markevans.github.io/dragonfly/urls/
위해 잠자리를 사용하여 같은
image "public/system/refinery/images/#{first_image.image_uid}", fit: [300,300]
업데이트
보인다.
나는이 생산 모드에서 실행 내 로컬 컴퓨터에 근무 S3
require 'open-uri'
...
image open("https://s3.amazonaws.com/<my bucket>/2014/07/16/01/31/47/621/3.jpg")
에서 파일을 다운로드하는 새우에 다음을 사용할 수 있습니다. 이제 이미지 용 S3 URL을 얻는 방법을 알아야합니다. 이 코드를 배포하면 내 S3 세션 대신 URL에 직접 액세스하려고하므로 HTTP 403 금지 오류가 발생합니다. 이 그것을 실제 파일을 전달하기 때문에 안개를 통한 연결
업데이트가 실패하고 난 새우 이미지 경로를 원하는 생각합니다.
con=Fog::Storage.new({provider: 'AWS', aws_access_key_id: ENV['S3_KEY'], aws_secret_access_key: ENV['S3_SECRET']})
d=con.directories.get("<my bucket>")
file=d.files.get('2014/07/16/01/31/47/621/3.jpg')
image file.body, fit:[30,30]
업데이트 : 생산 & 개발 환경에서 작업 할 수 있도록 지저분한 솔루션 여기
내 현재의 혼란 솔루션입니다. 그것은 작동하지만 끔찍한 보입니다.
images = @property.property_images.where("image_id > 0")
expire = (Time.now + 600).strftime('%s')
if ENV['RAILS_ENV']=="production"
# Make a connection to Amazon S3 through Fog
connection=Fog::Storage.new({provider: 'AWS', aws_access_key_id: ENV['S3_KEY'], aws_secret_access_key: ENV['S3_SECRET']})
dir=connection.directories.get("dcre_production")
end
if images.count > 0
# Display a large first image.
first_image = images.first.image
unless first_image.nil?
if ENV['RAILS_ENV']=="production"
# Download the first image from Amazon S3
file=dir.files.get(first_image.image_uid)
image open(file.url(expire)), fit:[300,300]
else
# Get the first image from local drive
image "public/system/refinery/images/#{first_image.image_uid}", fit: [300,300]
end
end
# Display thumbnails underneath
images.each do |property_image|
unless property_image.image.nil?
unless property_image.image.image_uid == first_image
if ENV['RAILS_ENV']=="production"
file=dir.files.get(property_image.image.image_uid)
image open(file.url(expire)), fit:[70,70]
else
filename = property_image.image.image_uid
image "public/system/refinery/images/#{filename}", fit: [70,70]
end
end
end
end
end
RefineryCMS에서 사용할 수있는 안개 연결이 이미 있습니까?
생산 여부에 따라 S3에 비해 로컬 저장소에서 읽는 것을 처리 할 수있는 더 좋은 방법이 있습니까?
안녕하세요. 새우 AWS 이미지에 포함 할 방법이 없나요? –