summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@gmail.com>2013-12-19 11:19:43 +0000
committerGreg Roach <fisharebest@gmail.com>2013-12-19 11:19:43 +0000
commit9d43aca4b5cd8c8a1d60867a096d89f604b5c67a (patch)
tree993794303f4e339515ef2b2396bcb589c670b657
parent45ad16922a65ce842b9280d8f5f36200bc48dfd5 (diff)
downloadwebtrees-9d43aca4b5cd8c8a1d60867a096d89f604b5c67a.tar.gz
webtrees-9d43aca4b5cd8c8a1d60867a096d89f604b5c67a.tar.bz2
webtrees-9d43aca4b5cd8c8a1d60867a096d89f604b5c67a.zip
#1261671 - MM generates thumbs with black background
-rw-r--r--library/WT/Media.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/library/WT/Media.php b/library/WT/Media.php
index 7f32b2fcf0..b008b4f082 100644
--- a/library/WT/Media.php
+++ b/library/WT/Media.php
@@ -155,6 +155,10 @@ class WT_Media extends WT_GedcomRecord {
$width = $THUMBNAIL_WIDTH;
$height = round($imgsize[1] * ($width/$imgsize[0]));
$thumb_image = @imagecreatetruecolor($width, $height);
+ // Create a transparent background, instead of the default black one
+ @imagesavealpha($thumb_image, true);
+ @imagefill($thumb_image, 0, 0, imagecolorallocatealpha($thumb_image, 0, 0, 0, 127));
+ // Shrink the image
@imagecopyresampled($thumb_image, $main_image, 0, 0, 0, 0, $width, $height, $imgsize[0], $imgsize[1]);
switch ($imgsize['mime']) {
case 'image/png': @imagepng ($thumb_image, $file); break;