aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_posting.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-06-07 08:35:13 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-06-07 08:35:13 +0000
commitc307c5021a63335b43c7eec8b9f3cc593573447f (patch)
treee2508f93158f470cd42fef6f79dbb3775c0a935a /phpBB/includes/functions_posting.php
parentdd9ad539fdab80badedf801a816b8a0beafbbf5c (diff)
downloadforums-c307c5021a63335b43c7eec8b9f3cc593573447f.tar
forums-c307c5021a63335b43c7eec8b9f3cc593573447f.tar.gz
forums-c307c5021a63335b43c7eec8b9f3cc593573447f.tar.bz2
forums-c307c5021a63335b43c7eec8b9f3cc593573447f.tar.xz
forums-c307c5021a63335b43c7eec8b9f3cc593573447f.zip
check if supported gd image type matches the uploaded image type - if not, thumbnails are not created.
git-svn-id: file:///svn/phpbb/trunk@6016 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_posting.php')
-rw-r--r--phpBB/includes/functions_posting.php30
1 files changed, 22 insertions, 8 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 53f11651a3..0c4e5c9afb 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -445,25 +445,29 @@ function get_supported_image_types($type = false)
{
switch ($type)
{
+ // GIF
case 1:
- $new_type = ($format & IMG_GIF) ? IMG_GIF : 0;
+ $new_type = ($format & IMG_GIF) ? IMG_GIF : false;
break;
+ // JPG, JPC, JP2
case 2:
case 9:
case 10:
case 11:
case 12:
- $new_type = ($format & IMG_JPG) ? IMG_JPG : 0;
+ $new_type = ($format & IMG_JPG) ? IMG_JPG : false;
break;
+ // PNG
case 3:
- $new_type = ($format & IMG_PNG) ? IMG_PNG : 0;
+ $new_type = ($format & IMG_PNG) ? IMG_PNG : false;
break;
+ // BMP, WBMP
case 6:
case 15:
- $new_type = ($format & IMG_WBMP) ? IMG_WBMP : 0;
+ $new_type = ($format & IMG_WBMP) ? IMG_WBMP : false;
break;
}
}
@@ -532,22 +536,28 @@ function create_thumbnail($source, $destination, $mimetype)
if ($type['gd'])
{
+ // If the type is not supported, we are not able to create a thumbnail
+ if ($type['format'] === false)
+ {
+ return false;
+ }
+
switch ($type['format'])
{
case IMG_GIF:
- $image = imagecreatefromgif($source);
+ $image = @imagecreatefromgif($source);
break;
case IMG_JPG:
- $image = imagecreatefromjpeg($source);
+ $image = @imagecreatefromjpeg($source);
break;
case IMG_PNG:
- $image = imagecreatefrompng($source);
+ $image = @imagecreatefrompng($source);
break;
case IMG_WBMP:
- $image = imagecreatefromwbmp($source);
+ $image = @imagecreatefromwbmp($source);
break;
}
@@ -583,6 +593,10 @@ function create_thumbnail($source, $destination, $mimetype)
imagedestroy($new_image);
}
+ else
+ {
+ return false;
+ }
}
if (!file_exists($destination))