Assume I have a favourite square size, and in this case it has `2236 px` width and height.

I need to save my images in this size on my server using `php intervention package`.

*It's not important that what is user's image size*, but the point is that the image have to save with new size but the user image have to be center and middle of the square **and if the picture is smaller than my favourite dimensions, it have to be stretch and if the image is bigger, it have to be compress to my dimension**.

Please take a look at this picture:
[![my plan](https://i.stack.imgur.com/TL2Ul.png)](https://i.stack.imgur.com/TL2Ul.png)

And these are some real examples:
[![example 1](https://i.stack.imgur.com/2gZ41.jpg)](https://i.stack.imgur.com/2gZ41.jpg)
[![example 2](https://i.stack.imgur.com/HlYVt.jpg)](https://i.stack.imgur.com/HlYVt.jpg)

Does anyone any experience in this situation and do you know how can I do that?

***Thanks in Advance***