Skip to content
This repository has been archived by the owner on Oct 5, 2018. It is now read-only.

Displaying original image while processing as an option to :processing_image_url #99

Closed
kamelury opened this issue Jul 29, 2014 · 3 comments

Comments

@kamelury
Copy link

The idea of displaying the original image while processing thumbs etc. seems to be floating around. However it is not available as an option in delayed_paperclip.
Is there any reason why you haven't done it already?
I am thinking about contributing to delayed_paperclip and submitting a patch request with it, but I would like to know if it was considered before or maybe rejected for some reason?

My idea was to make :processing_image_url accept a symbol of a method name in the model, that would be called to calculate the path to the original image. Or another option would be to allow :original symbol as on option for :processing_image_url.
I do struggle however to find the path of the original image in the paperclip attachment.

It can obviously be done in the view by checking .processing? and then displaying url(:thumb) or url(:original), but I treat it as a last resort

I would appreciate any suggestions or hints.

@peachananr
Copy link

Here's what I did:

process_in_background :photo, :processing_image_url => :process_image

def process_image
      options = photo.options
      options[:interpolator].interpolate(options[:url], photo, :original)
end

and everything seems to work ok at this point. Give it a go. :)

@kamelury
Copy link
Author

kamelury commented Aug 3, 2014

Fantastic! Thank you soo much! That is exactly what I was looking for.

@riffraff
Copy link

plase correct me if I'm wrong, but while this method works it could be slightly improved.

Namely: suppose I process online the styles "large" and "small", but in background I process "thumbnail", "hd", "landscape", "vignette" etc..

It would be great to be able to return a different fallback depending on which style is being currently requested, e.g.

def process_image fmt
      options = photo.options
      large_formats = %i[hd landscape desktop retina]
      fallback_format = large_formats.include?(fmt) ? :large : :small 
      options[:interpolator].interpolate(options[:url], photo, fallback_format)
end

Maybe this is already possible but I have not understood how :)

riffraff added a commit to riffraff/delayed_paperclip that referenced this issue Aug 27, 2014
As shown in jrgifford#99 this is not immediately obvious. Maybe it could also refer to paperclip's interpolator docs?
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants