Check image type in PHP

Quick PHP tip: If you’re looking to determine the type of uploaded image you can use the following code:

The code above shows a snippet to check if the uploaded image was a jpg, gif or png image type. As stated on the PHP documentation, this will return the same value as getimagesize() but it’s much faster.

, , ,

Powered by WordPress. Designed by Woo Themes