forked from GithubBackups/tinyib
Minor thumbnail function tweaks
This commit is contained in:
parent
4a65c03ee7
commit
cfe4ca8b6b
@ -362,18 +362,19 @@ function createThumbnail($name, $filename, $new_w, $new_h) {
|
|||||||
$thumb_w = round($old_x * $percent);
|
$thumb_w = round($old_x * $percent);
|
||||||
$thumb_h = round($old_y * $percent);
|
$thumb_h = round($old_y * $percent);
|
||||||
|
|
||||||
if (preg_match("/png/", $system[0]) && (imagepng($src_img, $filename))) {
|
|
||||||
$dst_img = imagecreatetruecolor($thumb_w, $thumb_h);
|
$dst_img = imagecreatetruecolor($thumb_w, $thumb_h);
|
||||||
|
if (preg_match("/png/", $system[0]) && imagepng($src_img, $filename)) {
|
||||||
imagealphablending($dst_img, false);
|
imagealphablending($dst_img, false);
|
||||||
imagesavealpha($dst_img, true);
|
imagesavealpha($dst_img, true);
|
||||||
|
|
||||||
$color = imagecolorallocatealpha($dst_img, 0, 0, 0, 0);
|
$color = imagecolorallocatealpha($dst_img, 0, 0, 0, 0);
|
||||||
imagefilledrectangle($dst_img, 0, 0, $thumb_w, $thumb_h, $color);
|
imagefilledrectangle($dst_img, 0, 0, $thumb_w, $thumb_h, $color);
|
||||||
imagecolortransparent($dst_img, $color);
|
imagecolortransparent($dst_img, $color);
|
||||||
} else {
|
|
||||||
$dst_img = ImageCreateTrueColor($thumb_w, $thumb_h);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageCopyResampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y);
|
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y);
|
||||||
|
} else {
|
||||||
|
fastimagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $thumb_w, $thumb_h, $old_x, $old_y);
|
||||||
|
}
|
||||||
|
|
||||||
if (preg_match("/png/", $system[0])) {
|
if (preg_match("/png/", $system[0])) {
|
||||||
if (!imagepng($dst_img, $filename)) {
|
if (!imagepng($dst_img, $filename)) {
|
||||||
@ -395,7 +396,7 @@ function createThumbnail($name, $filename, $new_w, $new_h) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function fastImageCopyResampled(&$dst_image, &$src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3) {
|
function fastimagecopyresampled(&$dst_image, &$src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality = 3) {
|
||||||
// Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable.
|
// Author: Tim Eckel - Date: 12/17/04 - Project: FreeRingers.net - Freely distributable.
|
||||||
if (empty($src_image) || empty($dst_image)) {
|
if (empty($src_image) || empty($dst_image)) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user