1. Naturally align images
2. There are many ways but I use the easiest without the use of css and js, all you need is a standard bootstrap classes and 2 conditions in php to insert every second and every third element div.
Layout 100% responsive and eliminates any possibility of plywanie content.
The advantage of this method is obvious
1. the lack of extra classes and media queries
2. 100% compatible with bootstrap
3. the absence of js, and again problems with adaption.
4. Ease of creation.
5. the stability of the solution.
6. Aligning the height only affects the line items in which you want to change the height without affecting the other elements
of the minuses
implementation in php and not in html though given the amount of logic wrapped around the directory in the php code add an empty div for every 3 div 2 or this stuff.