Use IMAGETYPE_* constants (#928)

This commit is contained in:
Roman Kelesidis 2023-10-02 14:14:27 +07:00 committed by GitHub
commit da39de5cf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,26 +63,24 @@ function get_supported_image_types($type)
$new_type = 0; $new_type = 0;
switch ($type) { switch ($type) {
case 1: case IMAGETYPE_GIF:
$new_type = ($format & IMG_GIF) ? IMG_GIF : 0; $new_type = ($format & IMG_GIF) ? IMG_GIF : 0;
break; break;
case 2: case IMAGETYPE_JPEG:
case 9: case IMAGETYPE_JPC:
case 10: case IMAGETYPE_JP2:
case 11: case IMAGETYPE_JPX:
case 12: case IMAGETYPE_JB2:
$new_type = ($format & IMG_JPG) ? IMG_JPG : 0; $new_type = ($format & IMG_JPG) ? IMG_JPG : 0;
break; break;
case 3: case IMAGETYPE_PNG:
case 4:
$new_type = ($format & IMG_PNG) ? IMG_PNG : 0; $new_type = ($format & IMG_PNG) ? IMG_PNG : 0;
break; break;
case 6: case IMAGETYPE_BMP:
case 8: case IMAGETYPE_WBMP:
case 15:
$new_type = ($format & IMG_WBMP) ? IMG_WBMP : 0; $new_type = ($format & IMG_WBMP) ? IMG_WBMP : 0;
break; break;
case 32: case IMAGETYPE_WEBP:
$new_type = ($format & IMG_WEBP) ? IMG_WEBP : 0; $new_type = ($format & IMG_WEBP) ? IMG_WEBP : 0;
break; break;
} }