-
Couldn't load subscription status.
- Fork 1.7k
Description
I have an uploader with this version:
version :png, if: :gif? do
process convert: 'png'
end(the gif? method reliably identifies a gif (this isn't the problem).)
the application has recently stopped users uploading gifs - so we're having to deal with gifs that were uploaded before the ban when creating a PDF with prawn. So now, when requesting an image we check to see if the original image was a gif, if so we redirect them to the 'png' version.
So far so good. Only the png version isn't working as expected - we're storing image on S3 and for an original image url
https://amazon-blah.com/bucket/image.gif
we get given back the url
https://amazon-blah.com/bucket/image_png.gif
and the image isn't stored to S3
I did a bit of googling and changed the png version to
version :png, if: :gif? do
process convert: 'png'
def full_filename (for_file = model.source.file)
super.chomp(File.extname(super)) + '.png'
end
endwhich now gives me the url
https://amazon-blah.com/bucket/image_png.png
but, again the image isn't stored - so it can't be retrieved from the url so i get a 403 response from S3.
I've also tried catching that 403 at the point in the code where the PDF generator is trying to open the image url and calling
recreate_versions!(:png)in the hope that would trigger the generated image to be stored - but no luck there, either. It can't be a permissions problem with S3 because the original images are uploaded just fine.
How do i get this version to be created AND stored? Am i missing a config setting? Is there something else daft i'm missing? Thanks