In this episode, we kick off the process of letting users crop their profile photos by setting up a modal dialog that appears as soon as a new photo is chosen. First, we focus on just getting the modal to open—using the Wire Elements modal package to make things quicker and neater.
You'll see how to install the package, set it up in your app layout, and ensure it's ready for use (it's Tailwind-ready, so no big hassle there). Once that's sorted, we update our profile photo Livewire component so that it reacts when an image is selected. On image change, we capture the temporary uploaded file.
We then build a new modal component called ProfilePhotoModal
and make sure it's hooked up, so the modal pops open when we choose a new image. Finally, we wire up the modal so it receives and displays the temp image file, proving everything works as expected.
At the end, we see our image nicely displayed inside the modal, which sets us up perfectly for the next step—letting the user actually crop it. Super straightforward, but a solid foundation!