0
votes

I am using active storage on rails 5.2.4 with the gems:

# Use ActiveStorage variant
gem 'rmagick', '~> 2.15', '>= 2.15.4'
gem 'mini_magick', '~> 4.8'
gem 'image_processing', '~> 0.2.3'

and trying with

    <%= image_tag photo.image.variant(resize: "1000x1000").processed.service_url, class: 'img-responsive-full' %>
    <%= image_tag photo.image.variant(resize: "1000x1000>").processed.service_url, class: 'img-responsive-full' %>
    <%= image_tag photo.image.variant(resize: "1000>x1000>").processed.service_url, class: 'img-responsive-full' %>

none of these methods is resizing the images or forcing the 1000x1000 dimensions I want, how could I force the images to be that size? (I have just migrated from paperclip to active storage)

1
According to the API documentation: api.rubyonrails.org/v5.2.4/classes/ActiveStorage/… it states that you're not supposed to be processing them inline. I'd try triggering the process in the controller or define the variants in the model.tywhang

1 Answers

0
votes

Adding a ! got it working:

<%= image_tag photo.image.variant(resize: "1000x1000!"), class: 'img-responsive-full' %>

Although I can not find an explanation on why was not resizing without it. By reading the documentation seems like it should work without any addition.