diff --git a/classes/file/FileHandler.class.php b/classes/file/FileHandler.class.php
index 6ffe9b8b67..e7ce6cd45a 100644
--- a/classes/file/FileHandler.class.php
+++ b/classes/file/FileHandler.class.php
@@ -751,9 +751,10 @@ function checkMemoryLoadImage(&$imageInfo)
* @param int $resize_height Height to resize
* @param string $target_type If $target_type is set (gif, jpg, png, bmp), result image will be saved as target type
* @param string $thumbnail_type Thumbnail type(crop, ratio)
+ * @param bool $thumbnail_transparent If $target_type is png, set background set transparent color
* @return bool TRUE: success, FALSE: failed
*/
- function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'crop')
+ function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'crop', $thumbnail_transparent = FALSE)
{
// check params
if (($source_file = self::exists($source_file)) === FALSE)
@@ -841,7 +842,24 @@ function createImageFile($source_file, $target_file, $resize_width = 0, $resize_
return FALSE;
}
- imagefilledrectangle($thumb, 0, 0, $resize_width - 1, $resize_height - 1, imagecolorallocate($thumb, 255, 255, 255));
+ if(function_exists('imagecolorallocatealpha') && $target_type == 'png' && $thumbnail_transparent)
+ {
+ imagefill($thumb, 0, 0, imagecolorallocatealpha($thumb, 0, 0, 0, 127));
+
+ if(function_exists('imagesavealpha'))
+ {
+ imagesavealpha($thumb, TRUE);
+ }
+
+ if(function_exists('imagealphablending'))
+ {
+ imagealphablending($thumb, TRUE);
+ }
+ }
+ else
+ {
+ imagefilledrectangle($thumb, 0, 0, $resize_width - 1, $resize_height - 1, imagecolorallocate($thumb, 255, 255, 255));
+ }
// create temporary image having original type
$source = NULL;
diff --git a/modules/member/lang/lang.xml b/modules/member/lang/lang.xml
index f1572a0c77..f28617b135 100644
--- a/modules/member/lang/lang.xml
+++ b/modules/member/lang/lang.xml
@@ -2806,4 +2806,9 @@