I have Item object that #has_many_attached :photos
. My Active storage service is GCS. I created a #thumbnail() instance method for Item. Like this:
def thumbnail(photo)
photo.variant(resize_and_pad: [400, 400, gravity: 'center', background: '#3D4453'])
end
I called it in the items show.html.erb file as:
<% @item.photos.each do |photo| %>
<%= image_tag(@item.thumbnail(photo)) %>
<% end %>
However this caused resized photos to be uploaded in GCS Bucket. So I end up with normal size photos and resized photos in my bucket. How can I avoid this ?