Hi Ashish,
Thanks for your response! Being as the original feature request is 5 months 
old, I figured it was worth revisiting as a possibility. My problem is not 
in serving resized assets (still a really awesome feature!) but rather *the 
inefficient use of cloud storage*. When someone is uploading photo evidence 
(live pinball scores in my case), we don't want to tell them they need to 
change their camera settings when their photos exceed a specified size (it 
doesn't appear you can natively do this at all on iOS in fact). Ultimately, 
we don't want to run up a big S3 bill storing assets at 10+ times their 
necessary resolution. If ActiveStorage is not a candidate for such a 
feature, is there an alternative option that can be recommended to solve 
this problem?

Thanks again!
- Ryan

On Sunday, April 28, 2019 at 2:46:47 AM UTC-7, Ashish Prajapati wrote:
>
> Hello Ryan,
>
> As far as, I understand after reading your issue that you want to reduce 
> the size of uploaded image before storing it to the cloud storage.
>
> Ryan, as DHH told in the above thread that uploads are considered 
> immutable so Active Storage doesn't support transforming/resizing the image 
> itself. We'll need to use the ImageMagick gem to do the resizing.
>
> We keep it simple and use a nice gem which does the work for us.
>
> 1. We have to add the image_processing gem to your Gemfile.
>
> gem 'image_processing'
>
> 2. After adding gem and bundle install, we can use a variant in view like
>
> <%= image_tag image.variant(resize: "100x100") %>
>
>
> On Sunday, April 28, 2019 at 2:29:02 PM UTC+5:30, Ryan Richardson wrote:
>
>> I have a small app where I'm allowing uploads of photos from cell phones 
>> via ActiveStorage. In order to not require users to change their default 
>> cell phone camera settings, I'm currently allowing image uploads of 
>> unnecessary file size. Would it be feasible to hook in after the asset data 
>> is posted, but before the uploaded asset is initially pushed to cloud 
>> storage, in order to reduce the asset's file size to a more reasonable max? 
>>
>> On Thursday, November 22, 2018 at 8:53:47 AM UTC-8, DHH wrote:
>>>
>>> These uploads are considered immutable. If you want to store something 
>>> else than the original, you should do the transformation on the original 
>>> and upload the new image.
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to