Source
71
71
$thumbWidth = $b * $thumbHeight;
72
72
}
73
73
else {
74
74
$thumbHeight = $thumbWidth / $b;
75
75
}
76
76
}
77
77
78
78
$thumbWidth = (int) round($thumbWidth);
79
79
$thumbHeight = (int) round($thumbHeight);
80
80
81
-
if (function_exists('imagecreatetruecolor') && @imagecreatetruecolor(1, 1)) {
82
-
$thumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
83
-
}
84
-
else {
85
-
$thumb = imagecreate($thumbWidth, $thumbHeight);
86
-
}
81
+
$thumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
87
82
88
83
// preserve png transparency
89
84
imagealphablending($thumb, false);
90
85
imagesavealpha($thumb, true);
91
86
92
87
imagecopyresampled(
93
88
$thumb, $source,
94
89
0, 0,
95
90
0, 0,
96
91
$thumbWidth, $thumbHeight,
97
-
$srcWidth, $srcHeight);
92
+
$srcWidth, $srcHeight
93
+
);
98
94
99
95
imagedestroy($source);
100
96
$source = $thumb;
101
97
}
98
+
102
99
return $source;
103
100
}
104
101
105
102
/**
106
103
* Creates an image from a string preserving PNG transparency.
107
104
*
108
105
* @param $imageString
109
106
*
110
107
* @return resource
111
108
*/