Resizing Active Storage Image Uploads With MiniMagick | Ruby On Rails 5.2 Tutorial

  Рет қаралды 8,726

Deanin

Deanin

Күн бұрын

Пікірлер: 23
@Deanin
@Deanin 6 жыл бұрын
The current schedule involves a Devise tutorial coming out tomorrow, a video on uploading videos with Active Storage on Saturday, and a FriendlyId tutorial for Sunday. Next week will probably see the start of the first project series, where we spend several episodes building an application by putting some of these topics together. There'll also be some Action Cable tutorials next week probably. Thanks for watching and subscribing everyone, the feedback means a lot!
@timetails9610
@timetails9610 6 жыл бұрын
Oh 😑
@Pandesaltosino
@Pandesaltosino 6 жыл бұрын
bruh, i cant wait for the whole project tutorial. thanks for the update
@UsefulProgrammer
@UsefulProgrammer 4 жыл бұрын
You've got one of my favorite coding channels Deanin - Thanks for theses.
@Deanin
@Deanin 4 жыл бұрын
I appreciate the kind words! Glad the videos are helping people out!
@dannyskybox293
@dannyskybox293 3 жыл бұрын
Thank! exactly what i was looking for. super clear tutorial!
@lcastiillo
@lcastiillo 6 жыл бұрын
Dude!! Many thanks! Super clear tutorial.
@Deanin
@Deanin 6 жыл бұрын
You're welcome, I'm glad it helped someone!
@PeerSpot
@PeerSpot 6 жыл бұрын
Great video. Simple and clear. Lots of people are coming from PaperClip and i was wondering how to replace the functionality of the # sign in, as in '50x50#'. Does the ! do the same image processing?
@dariayudina8463
@dariayudina8463 6 жыл бұрын
actual question
@张翔-v2u
@张翔-v2u 6 жыл бұрын
thanks before looking! It's a new brand feature,so i find bare tutorial about it .
@sithubo24
@sithubo24 5 жыл бұрын
Hi Deanin How can I solve this error? "PS C:\pinterest> rails active_storage:install rails aborted! Don't know how to build task 'active_storage:install' (See the list of available tasks with `rails --tasks`) bin/rails:4:in `require' bin/rails:4:in `' (See full trace by running task with --trace)"
@Pandesaltosino
@Pandesaltosino 6 жыл бұрын
do you know how to do the resize with multiple images? I get this error "undefined method 'variant' for #... " model code: has_many_attached :uploads def thumbnail return self.uploads.variant(resize: '200x200').processed end
@Deanin
@Deanin 6 жыл бұрын
Yeah, let me just run through the setup for anyone else wondering how this works. 1. Inside of your model, change it from has_one_attached :image to has_many_attached :images 2. Inside the params for your controller, change it from permit(..., :image) to (..., images: []) 3. Change your view's form from form.file_field :image to: form.file_field :images, multiple: true 4. Inside your pin model, add in a parameter for the method: def thumbnail(input) 5. Then change any reference to the image inside that method from: image.variant to instead be return self.images[input].variant(resize: '1920x1080').processed 6. Then anywhere that you want to access the image, you would instead do the following: or or This allows you to treat the images in a similar way to how you did when you only had one. Hope this helps, I'll have a video covering multiple uploads up in a bit because this seems like it warrants its own video. :)
@Pandesaltosino
@Pandesaltosino 6 жыл бұрын
aah I see. I missed this part thumbnail(input). just to confirm, this is because of the array? also, thank you!
@Deanin
@Deanin 6 жыл бұрын
Yup! I just finished recording a video covering it, I'll have it up in a couple hours. :)
@Coul777exe
@Coul777exe 5 жыл бұрын
Thank you!
@mehmetsamilbuyukcaglayan5421
@mehmetsamilbuyukcaglayan5421 4 жыл бұрын
Everytthig is fine but I couldnt find a way to use mini magick with active storage. Your way is not working :(
@mehmetsamilbuyukcaglayan5421
@mehmetsamilbuyukcaglayan5421 4 жыл бұрын
Atleast I couldnt make it work
@Deanin
@Deanin 4 жыл бұрын
Sorry to hear it didn't work! I think they deprecated minimagick in Rails 6. You might need to use the image_processing gem instead if you're on Rails 6. I think the commands are the same, it's just under a different gem name. I'll include a link below. If this doesn't work still, or you're not on Rails 6, please let me know and I'll see if I can help troubleshoot. github.com/janko/image_processing
@mehmetsamilbuyukcaglayan5421
@mehmetsamilbuyukcaglayan5421 4 жыл бұрын
@@Deanin Thanks for your quick response. Yeah I checked image processing too. I was actually looking for how do I watermark with mini_magick. And I found a way in a blog. May I share link ?
@Deanin
@Deanin 4 жыл бұрын
Yeah of course! The link will help out other people looking at this later. I appreciate that you're willing to share your resources!
@mehmetsamilbuyukcaglayan5421
@mehmetsamilbuyukcaglayan5421 4 жыл бұрын
ruby.zigzo.com/2018/09/22/watermarking-images-with-active-storage/ This post shows us how to watermark. It also look like a guide for how to use other ImageMagick options.
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.
БОЙКАЛАР| bayGUYS | 27 шығарылым
28:49
bayGUYS
Рет қаралды 1,1 МЛН
HTML Basic Tags
8:39
Prof Triumph
Рет қаралды 6
I Helped 2,000 People Walk Again
15:31
MrBeast
Рет қаралды 13 МЛН
User Avatars with Rails Active Storage
11:48
GoRails
Рет қаралды 15 М.
No Refresh User Favorites & A Favorites Feed | Ruby On Rails
16:49
Background Processing with Rails, Redis and Sidekiq
15:00
Decypher Media
Рет қаралды 62 М.
Rails 5.2 ActiveStorage Introduction
20:55
GoRails
Рет қаралды 22 М.
«Жат бауыр» телехикаясы І 26-бөлім
52:18
Qazaqstan TV / Қазақстан Ұлттық Арнасы
Рет қаралды 434 М.