Single column Gallery

I would like to ask for help with the realization of the gallery in 1 row

I need a gallery that would automatically place photos, The vertical ones are bigger margin, and the horizontal ones are smaller
Also, so that the gallery itself would understand where the vertical photos and where the horizontal ones are, so that I would not have to do it manually every time with the help of paddings on the page itself for different projects

Is it possible to realize this somehow?

I will attach some screenshots with examples

Here is my site Read-Only: LINK
(how to share your site Read-Only link)