Luis Daniel Fonseca

Joined

120 Experience
0 Lessons Completed
0 Questions Solved

Activity

Hey Chris! Thanks a lot for getting back to me.

Do you think it would make sense to implement like a post-process user images feature?

Something like this: https://www.freecodecamp.org/news/how-to-post-process-user-images-programmatically-with-rails-amazon-s3-including-testing-c72645536b54/

While they release that option of using direct urls to AWS on Active Storage.

The thing is that I already implemented the basic features for active storage, and I already had some users uploading their profile picture.

Thanks again!

I can't get user.avatar.variant(resize: "200x200") to work while using a cloud provider in production because it uses my website path instead of aws.

<%= image_tag user.avatar.variant(resize: "200x200") %> 

# Current Output
<img src="https://mywebsite.com/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBCdz09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--3f8b21aebb9ca4fc9fe9043a1acc3e77e999319a/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9MY21WemFYcGxTU0lLTVRCNE1UQUdPZ1pGVkE9PSIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--6b94a1495d331d40bee31fadf0e8dc9323a7e1bc/image.jpg">

# Should be
<img src="aws.com/img.jpg">

I need to user.avatar.service_url.split("?").first to get the right path for the img but when I do this, I can't use .variant() because that path is a string.

# this works but can't resize    
<%= image_tag user.avatar.service_url.split("?").first %> 

Any idea how I overcome this.

Thanks!

I can't get variant(size: "") to work while using a cloud provider in production.

I need to user.avatar.service_url.split("?").first to get the right path for the img but when I do this, I can't use .variant() because that path is a string.

Any idea how I overcome this.

Thanks!

Hi Oliver,

I can't get variant(size: "") to work while using a cloud provider in production.

I need to user.avatar.service_url.split("?").first to get the right path for the img but when I do this, I can't use variant because that path is a string.

Any idea how I overcome this.

Thanks!

logo Created with Sketch.

Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

© 2020 GoRails, LLC. All rights reserved.