You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.
I am trying to upload multiple images using the client side, and after that linking them with paperclip.
I am using s3_direct_upload which gives me the url where the image has been uploaded to s3, then I can then find out where Paperclip is going to search for the image, so it can reprocess it. I copy the image to that location. And expect delayed_paperclip to add to the Dalyed:Job queue, but it doesn't.
def ....
uploaded_file_url = params[:url].gsub("%2F", "/")
#getting the location of the picture
filename = File.basename(uploaded_file_url)
filetype = "image/jpeg"
ActiveRecord::Base.transaction do
credentials = Aws::Credentials.new Rails.application.config.aws[:access_key_id], Rails.application.config.aws[:secret_access_key]
s3 = Aws::S3::Client.new(region: Rails.application.config.aws[:region], credentials: credentials)
s3.copy_object({bucket: Rails.application.config.paperclip_defaults[:s3_credentials][:bucket], copy_source:uploaded_file_url , key: content_picture.picture.path ,acl: "public-read"})
#setting up and copying the picture where content_picture.picture.url is looking for.
end
instance.content_pictures << content_picture
And with this I have no Delayed::Job to execute.
I have to do content_picture.picture.reprocess! which downloads and reuploads the picture to S3.
I have the uploading handled on the client side and I only want to execute the delayed job which will download the picture, process it and upload it where it needs to be.
The text was updated successfully, but these errors were encountered:
Hello,
I am trying to upload multiple images using the client side, and after that linking them with paperclip.
I am using s3_direct_upload which gives me the url where the image has been uploaded to s3, then I can then find out where Paperclip is going to search for the image, so it can reprocess it. I copy the image to that location. And expect delayed_paperclip to add to the Dalyed:Job queue, but it doesn't.
def ....
uploaded_file_url = params[:url].gsub("%2F", "/")
#getting the location of the picture
filename = File.basename(uploaded_file_url)
filetype = "image/jpeg"
id = ContentPicture.maximum(:id).try(:next) || 1
content_picture = ContentPicture.new(id: id, picture_file_name:filename, picture_content_type:filetype)
ActiveRecord::Base.transaction do
credentials = Aws::Credentials.new Rails.application.config.aws[:access_key_id], Rails.application.config.aws[:secret_access_key]
end
instance.content_pictures << content_picture
And with this I have no Delayed::Job to execute.
I have to do
content_picture.picture.reprocess!
which downloads and reuploads the picture to S3.I have the uploading handled on the client side and I only want to execute the delayed job which will download the picture, process it and upload it where it needs to be.
The text was updated successfully, but these errors were encountered: