Resize MC based on loaded image

Hi all,

I’m not really sure how this works but I’ve seen a lot of examples online. There is a gallery in which a black background resizes and an image of the same aspect ratio loads on top of it. When a new image is selected, the background changes shape to accomodate the new dimensions.

Any direction would be greatly appreciated. Thanks in advance!

Woody