$image = getImage('path/to/image.jpg');
$image = getImage('path/to/image.png'); $type = exif_imagetype('path/to/image.png'); switch($type) { case IMAGETYPE_PNG: echo 'PNG file'; echo 'GD library'; break; case IMAGETYPE_JPEG: echo 'JPEG file'; echo 'GD library'; break; case IMAGETYPE_GIF: echo 'GIF file'; echo 'GD library'; break; case IMAGETYPE_WEBP: echo 'WebP file'; echo 'Imagick library'; break; default: echo 'Unknown file type'; }This code reads the image file 'image.png' and checks its type using the function exif_imagetype(). The switch case then determines the file type and the image processing library used by PHP. In this case, the file type is PNG and the library used is GD. For WebP files, the Imagick library is used.