Repository navigation
Image attachment with activestorage - #775
Conversation
2d80b98 to
015be0a
Compare
| gem 'fog-aws', '~> 2.0.0' | ||
| gem 'formatted-dates' | ||
| gem 'has_scope', '~> 0.7.1' | ||
| gem 'image_processing' |
There was a problem hiding this comment.
We need to make sure if imagemagick is installed.
There was a problem hiding this comment.
we'll need an .ebextention to cover that
|
Hm... I was thinking cloudinary would be good to help with porn-prevention in image uploads, but looks like https://cloudinary.com/blog/how_to_automate_image_moderation_with_amazon_rekognition says we'd need to set up AWS rekognition for that. In which case maybe we could just use activestorage. @eitoball is there something in here that'll put the images on s3? We can't just have them go to disk since the app autoscales. |
|
https://stackoverflow.com/questions/55099418/rails-active-storage-aws-rekognition-how-to-get-io-file looks pretty simple and https://aws.amazon.com/rekognition/pricing/ pretty cheap. Maybe we could just go that route to avoid porn uploads. |
@matschaffer Not yet. I wasn't sure what service we're gonna use. Can I use the same access key ID and secret access key as those to store bGegie logs files? Or, different ID and key? |
|
Same should be fine. The ec2 instance has an IAM profile for that bucket. Maybe put images in another prefix just so they don’t get mixed with uploads. |
6fb4cb3 to
68061dd
Compare
matschaffer
left a comment
There was a problem hiding this comment.
Looks promising so far. Is it ready for dev? Not sure how automagic the s3 part is so let me know when you're ready for deployment.
| errors.add(:image, 'is too large (maximum is 10MB)') | ||
| end | ||
|
|
||
| VALID_IMAGE_TYPES = [Mime[:bmp], Mime[:jpeg], Mime[:gif], Mime[:png]].freeze |
There was a problem hiding this comment.
I sure hope no-one will really upload a bmp, but good that we support it 😆
@matschaffer Sort of. We need to create a S3 bucket to store image and set the bucket name in environment variable If it is okay, I would like to deploy to dev environment by myself. If so, I would like to set up environment variables in Beanstalk. |
|
Go for it :)
On Fri, Feb 19, 2021 at 19:20 Eito Katagiri ***@***.***> wrote:
Is it ready for dev? Not sure how automagic the s3 part is so let me know
when you're ready for deployment.
@matschaffer <https://github.com/matschaffer> Sort of. We need to create
a S3 bucket to store image and set the bucket name in environment variable
DEVICE_STORY_COMMENT_IMAGES_BUCKET.
If it is okay, I would like to deploy to dev environment by myself. If so,
I would like to set up environment variables in Beanstalk.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#775 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAAFMQ2VNIWT4576RHK6VDS7Y3P3ANCNFSM4XYPC2NQ>
.
--
…-Mat
matschaffer.com
|
2556881 to
00c79f3
Compare
Co-Authored-By: Nakushi64 <[email protected]>
00c79f3 to
759618a
Compare
759618a to
37c0794
Compare
matschaffer
left a comment
There was a problem hiding this comment.
Looks great @eitoball ! Thanks 🧡
This PR tries to use Active Storage to attach image to device story comments like in #765.
For more information about Active Storage, see https://guides.rubyonrails.org/v5.2/active_storage_overview.html#attaching-file-io-objects.
I am not sure if Cloudinary is required. If required, we still can integrate like in https://cloudinary.com/documentation/rails_activestorage