jrgifford / delayed_paperclip

Process your Paperclip attachments in the background with delayed_job or Resque.
http://www.jstorimer.com/ruby/2010/01/30/delayed-paperclip.html
MIT License
402 stars 155 forks source link

Error #46

Closed pratz3 closed 11 years ago

pratz3 commented 11 years ago

Everything worked fine until I added:

process_in_background :avatar - to my model.

I'm using S3 to store the images and I am using cropping as suggested by Ryan Bates in Railcasts Episode 182. After adding delayed_paperclip I am getting an error. It is weirdly pointing to this method:

def avatar_geometry(style = :original) @geometry ||= {} avatar_path = (avatar.options[:storage] == :s3) ? avatar.url(style) : avatar.path(style) @geometry[style] ||= Paperclip::Geometry.from_file(avatar_path) end

But the method works fine when I comment out process_in_background :avatar and I am able to crop and reprocess. It's just that it wont delay the job and takes 8-12 seconds. Is it throwing an error because the avatar_path should be different when using delayed_paperclip?

ScotterC commented 11 years ago

Can you post the relevant part of the stack trace please?

On Saturday, July 27, 2013, pratz3 wrote:

Everything worked fine until I added:

process_in_background :avatar - to my model.

I'm using S3 to store the images and I am using cropping as suggested by Ryan Bates in Railcasts Episode 182. After adding delayed_paperclip I am getting an error. It is weirdly pointing to this method:

def avatar_geometry(style = :original) @geometry https://github.com/geometry ||= {} avatar_path = (avatar.options[:storage] == :s3) ? avatar.url(style) : avatar.path(style) @geometry https://github.com/geometry[style] ||= Paperclip::Geometry.from_file(avatar_path) end

But the method works fine when I comment out process_in_background :avatar and I am able to crop and reprocess. It's just that it wont delay the job and takes 8-12 seconds. Is it throwing an error because the avatar_path should be different when using delayed_paperclip?

— Reply to this email directly or view it on GitHubhttps://github.com/jrgifford/delayed_paperclip/issues/46 .

Sent from Mobile

pratz3 commented 11 years ago

Well, the cropping feature essentially needs a file from S3. The image is scaled down and shown in the cropping page. But because of delayed jobs it can't find the file as it hasn't been uploaded yet and that's why the error. So I need to do something else. Thanks though