gd_edit_image_support

Definition:
function gd_edit_image_support($mime_type) {}

Check if the installed version of GD supports particular image type

Parameters

  • string $mime_type

Source code

function gd_edit_image_support($mime_type) {

	if ( function_exists('imagetypes') ) {

		switch( $mime_type ) {

			case 'image/jpeg':

				return (imagetypes() & IMG_JPG) != 0;

			case 'image/png':

				return (imagetypes() & IMG_PNG) != 0;

			case 'image/gif':

				return (imagetypes() & IMG_GIF) != 0;

		}

	} else {

		switch( $mime_type ) {

			case 'image/jpeg':

				return function_exists('imagecreatefromjpeg');

			case 'image/png':

				return function_exists('imagecreatefrompng');

			case 'image/gif':

				return function_exists('imagecreatefromgif');

		}

	}

	return false;

}

1102

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: