mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 22:28:51 +00:00
- added ability to grab supported gd formats
git-svn-id: file:///svn/phpbb/trunk@5039 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
a082635b76
commit
9c4b9d9dae
1 changed files with 35 additions and 19 deletions
|
@ -376,32 +376,48 @@ function get_img_size_format($width, $height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return supported image types
|
// Return supported image types
|
||||||
function get_supported_image_types($type)
|
function get_supported_image_types($type = false)
|
||||||
{
|
{
|
||||||
if (@extension_loaded('gd'))
|
if (@extension_loaded('gd'))
|
||||||
{
|
{
|
||||||
$format = imagetypes();
|
$format = imagetypes();
|
||||||
$new_type = 0;
|
$new_type = 0;
|
||||||
|
|
||||||
switch ($type)
|
if ($type !== false)
|
||||||
{
|
{
|
||||||
case 1:
|
switch ($type)
|
||||||
$new_type = ($format & IMG_GIF) ? IMG_GIF : 0;
|
{
|
||||||
break;
|
case 1:
|
||||||
case 2:
|
$new_type = ($format & IMG_GIF) ? IMG_GIF : 0;
|
||||||
case 9:
|
break;
|
||||||
case 10:
|
case 2:
|
||||||
case 11:
|
case 9:
|
||||||
case 12:
|
case 10:
|
||||||
$new_type = ($format & IMG_JPG) ? IMG_JPG : 0;
|
case 11:
|
||||||
break;
|
case 12:
|
||||||
case 3:
|
$new_type = ($format & IMG_JPG) ? IMG_JPG : 0;
|
||||||
$new_type = ($format & IMG_PNG) ? IMG_PNG : 0;
|
break;
|
||||||
break;
|
case 3:
|
||||||
case 6:
|
$new_type = ($format & IMG_PNG) ? IMG_PNG : 0;
|
||||||
case 15:
|
break;
|
||||||
$new_type = ($format & IMG_WBMP) ? IMG_WBMP : 0;
|
case 6:
|
||||||
break;
|
case 15:
|
||||||
|
$new_type = ($format & IMG_WBMP) ? IMG_WBMP : 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$new_type = array();
|
||||||
|
$go_through_types = array(IMG_GIF, IMG_JPG, IMG_PNG, IMG_WBMP);
|
||||||
|
|
||||||
|
foreach ($go_through_types as $check_type)
|
||||||
|
{
|
||||||
|
if ($format & $check_type)
|
||||||
|
{
|
||||||
|
$new_type[] = $check_type;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
|
|
Loading…
Add table
Reference in a new issue