delayed_paperclip icon indicating copy to clipboard operation
delayed_paperclip copied to clipboard

Displaying images during processing fails

Open owahab opened this issue 9 years ago • 4 comments

I have this Rails model with a paperclip attachment. The model looks like this:

class Photo < Asset
  has_attached_file :attachment,
    url: '/system/assets/:attachment/:id_partition/:style/:filename',
    styles: {
      medium: '640x480>',
      small: '240x240#',
      thumb: '48x48#'
    },
    default_style: :small
  process_in_background :attachment
end

The problem is quite simple:

pry(main)> Photo.last.attachment.processing?
=> true
pry(main)> Photo.last.attachment.url
=> "/system/assets/attachments/000/000/001/original/photo.jpg"

Expected (according to README file):

pry(main)> Photo.last.attachment.url
=> "/images/original/missing.png"

What am I doing wrong?

owahab avatar Apr 16 '15 12:04 owahab

You're accessing the unprocessed, original, image with attachment.url. This will be present regardless of what processing needs to take place. If you try Photo.last.attachment.url(:thumb) you should see the missing path returned.

shadwell avatar Aug 27 '15 12:08 shadwell

However, the docs do suggest that attachment.url will return the missing path. I'd suggest that's a mistake in the docs rather than the code.

shadwell avatar Aug 27 '15 12:08 shadwell

No I have the exact same issue, Im using

Photo.last.attachment.url(:thumb)

and it returns the url of the image that is being processed, in my case Im using Amazon s3, so the result is a broken image. I even tried: processing_image_url:however the result is the same...

ssoulless avatar Nov 23 '15 03:11 ssoulless

@ssoulless You may have forgotten to add the <attachment>_processing column.

janko avatar Dec 30 '15 22:12 janko