Working with images and cropping, resizing and other functions related to this can be quite challenging sometimes because the math on the backend can be pretty hard to understand. You need to keep in mind the rations, height and width values, etc.
Hopefully, phpThumb is here to help. This PHP library handles all the backend hard code for creating thumbnails using just a few lines of code. Accepting all types of image sources (from filesystem, URL or database) and all popular formats, you can rotate, crop, watermark images. Also, the quality of the images can be defined and there is build-in caching to minimize server load.
This PHP library for creating thumbnails also provides a wide collection of filters like contrast, blur, brightness or applying rounded corners and more.