I have an Active Storage image variant e.g.
<%= image_tag model.logo_image.variant(resize_to_fit: [300, 200]) %>
I'm trying to get the width
and height
values of this variant (since they are unknown) for use in the width
and height
HTML attributes.
I expected them to be here:
model.logo_image.variant(resize_to_fit: [300, 200]).processed.blob.metadata
But this gives me the metadata of the original file not the resized variant e.g.
{"identified"=>true, "width"=>800, "height"=>174, "analyzed"=>true}
How do I get the dimensions of an Active Storage variant?