-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Versioning bug #2126
Comments
@bengalamx - I am experiencing a similar issue with nearly identical code. All my images are uploaded to S3 in the properly converted format and extension, but the |
@ThomasBush did you find a solution? I still have this problem. |
@bengalamx yes, the only way I could get this to work was to override the file name inside each version to replace the incorrect extension with the correct one. I have included an example below. version :square do
process resize_and_pad: [400, 400, '#FFFFFF', 'Center']
process :convert => 'jpg'
def full_filename(for_file = model.file_name.file)
"square_#{for_file.sub('png', 'jpg')}"
end
end |
I just added some scopes to my User model, so I do def avatar_large
self.has_avatar? ? self.avatar.large.url.gsub(/.png|.jpeg/, '.jpg') : self.avatar.large
end
def avatar_small
self.has_avatar? ? self.avatar.small.url.gsub(/.png|.jpeg/, '.jpg') : self.avatar.small
end
def avatar_thumb
self.has_avatar? ? self.avatar.thumb.url.gsub(/.jpg|.jpeg/, '.png') : self.avatar.thumb
end
def avatar_tiny
self.has_avatar? ? self.avatar.tiny.url.gsub(/.jpg|.jpeg/, '.png') : self.avatar.tiny
end But yours seems like a good solution. I'll give it a try. Thanks! |
Carrierwave is having a lot of bugs when versioning images, this is another issue that may have priority. When you recreate avatars, it uploads the correct files to S3, but then the avatar version urls for some strange reason changes. This is what happens working in console:
The text was updated successfully, but these errors were encountered: