CodeIgniter 4 already has an Image Manipulation class for customizing images. With this, you can resize, change quality, rotate, crop, and add a watermark to the image.
It supports GD and ImageMagick library.
In this tutorial, I show how you can upload and resize image dimensions in CodeIgniter 4.