aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2005-01-02 19:08:07 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2005-01-02 19:08:07 +0000
commit9c4b9d9dae63367410f152e1250b3ace48aaf0de (patch)
treeddda724c1595cf43a103481c6dfa6896cec901e2 /phpBB/includes
parenta082635b76b6191eeb717ef5d00f0ca86d038a01 (diff)
downloadforums-9c4b9d9dae63367410f152e1250b3ace48aaf0de.tar
forums-9c4b9d9dae63367410f152e1250b3ace48aaf0de.tar.gz
forums-9c4b9d9dae63367410f152e1250b3ace48aaf0de.tar.bz2
forums-9c4b9d9dae63367410f152e1250b3ace48aaf0de.tar.xz
forums-9c4b9d9dae63367410f152e1250b3ace48aaf0de.zip
- added ability to grab supported gd formats
git-svn-id: file:///svn/phpbb/trunk@5039 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_posting.php54
1 files changed, 35 insertions, 19 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 4353871719..06734c65d7 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -376,32 +376,48 @@ function get_img_size_format($width, $height)
}
// Return supported image types
-function get_supported_image_types($type)
+function get_supported_image_types($type = false)
{
if (@extension_loaded('gd'))
{
$format = imagetypes();
$new_type = 0;
- switch ($type)
+ if ($type !== false)
{
- case 1:
- $new_type = ($format & IMG_GIF) ? IMG_GIF : 0;
- break;
- case 2:
- case 9:
- case 10:
- case 11:
- case 12:
- $new_type = ($format & IMG_JPG) ? IMG_JPG : 0;
- break;
- case 3:
- $new_type = ($format & IMG_PNG) ? IMG_PNG : 0;
- break;
- case 6:
- case 15:
- $new_type = ($format & IMG_WBMP) ? IMG_WBMP : 0;
- break;
+ switch ($type)
+ {
+ case 1:
+ $new_type = ($format & IMG_GIF) ? IMG_GIF : 0;
+ break;
+ case 2:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ $new_type = ($format & IMG_JPG) ? IMG_JPG : 0;
+ break;
+ case 3:
+ $new_type = ($format & IMG_PNG) ? IMG_PNG : 0;
+ break;
+ case 6:
+ 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(