Minor improvements (#287)

This commit is contained in:
Roman Kelesidis 2023-10-02 14:03:18 +07:00 committed by GitHub
parent c37badf8a9
commit 9c1b2598c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 22 deletions

View File

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

View File

@ -27,18 +27,10 @@ class upload_common
var $ext_ids = array(); // array_flip($bb_cfg['file_id_ext'])
var $errors = array();
var $img_types = array(
// Не редактируйте!
1 => 'gif',
2 => 'jpg',
3 => 'png',
// 4 => 'swf', // [зарезервировано]
// 5 => 'psd', // [зарезервировано]
6 => 'bmp',
// 7 => 'tiff', // байтовый порядок intel [зарезервировано]
// 8 => 'tiff', // байтовый порядок motorola [зарезервировано]
// 9 => 'jpc', // [зарезервировано]
// 10 => 'jp2', // [зарезервировано]
// 11 => 'jpx', // [зарезервировано]
IMAGETYPE_GIF => 'gif',
IMAGETYPE_JPEG => 'jpg',
IMAGETYPE_PNG => 'png',
IMAGETYPE_BMP => 'bmp',
);
function init ($cfg = array(), $post_params = array(), $uploaded_only = true)