|
|
@ -40,16 +40,14 @@ class image { |
|
|
|
$size [1] = $this->bgy; |
|
|
|
$size [1] = $this->bgy; |
|
|
|
|
|
|
|
|
|
|
|
if ($border == 1) { |
|
|
|
if ($border == 1) { |
|
|
|
|
|
|
|
if ($specific_size) { |
|
|
|
if ($specific_size) { |
|
|
|
$width = $thumbw; |
|
|
|
$width = $thumbw; |
|
|
|
$height = $thumbh; |
|
|
|
$height = $thumbh; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$scale = min($thumbw / $size[0], $thumbh / $size[1]); |
|
|
|
$scale = min($thumbw / $size[0], $thumbh / $size[1]); |
|
|
|
$width = (int)($size[0] * $scale); |
|
|
|
$width = (int)($size[0] * $scale); |
|
|
|
$height = (int)($size[1] * $scale); |
|
|
|
$height = (int)($size[1] * $scale); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$deltaw = (int)(($thumbw - $width) / 2); |
|
|
|
$deltaw = (int)(($thumbw - $width) / 2); |
|
|
|
$deltah = (int)(($thumbh - $height) / 2); |
|
|
|
$deltah = (int)(($thumbh - $height) / 2); |
|
|
|
$dst_img = @ImageCreateTrueColor($thumbw, $thumbh); |
|
|
|
$dst_img = @ImageCreateTrueColor($thumbw, $thumbh); |
|
|
@ -58,31 +56,23 @@ class image { |
|
|
|
} |
|
|
|
} |
|
|
|
$this->bgx = $thumbw; |
|
|
|
$this->bgx = $thumbw; |
|
|
|
$this->bgy = $thumbh; |
|
|
|
$this->bgy = $thumbh; |
|
|
|
} |
|
|
|
} elseif ($border == 0) { |
|
|
|
elseif ($border == 0) { |
|
|
|
if ($specific_size) { |
|
|
|
|
|
|
|
$width = $thumbw; |
|
|
|
|
|
|
|
$height = $thumbh; |
|
|
|
if ($specific_size) { |
|
|
|
} else { |
|
|
|
$width = $thumbw; |
|
|
|
$scale = ($size[0] > 0 && $size[1] > 0) ? min($thumbw / $size[0], $thumbh / $size[1]) : 0; |
|
|
|
$height = $thumbh; |
|
|
|
$width = (int)($size[0] * $scale); |
|
|
|
} else { |
|
|
|
$height = (int)($size[1] * $scale); |
|
|
|
$scale = ($size[0] > 0 && $size[1] > 0) ? min($thumbw / $size[0], $thumbh / $size[1]) : 0; |
|
|
|
} |
|
|
|
$width = (int)($size[0] * $scale); |
|
|
|
|
|
|
|
$height = (int)($size[1] * $scale); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$deltaw = 0; |
|
|
|
$deltaw = 0; |
|
|
|
$deltah = 0; |
|
|
|
$deltah = 0; |
|
|
|
$dst_img = @ImageCreateTrueColor($width, $height); |
|
|
|
$dst_img = @ImageCreateTrueColor($width, $height); |
|
|
|
$this->bgx = $width; |
|
|
|
$this->bgx = $width; |
|
|
|
$this->bgy = $height; |
|
|
|
$this->bgy = $height; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$src_img = $this->bg; |
|
|
|
$src_img = $this->bg; |
|
|
|
|
|
|
|
|
|
|
|
@ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img)); |
|
|
|
@ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img)); |
|
|
|
|
|
|
|
|
|
|
|
$this->bg=$dst_img; |
|
|
|
$this->bg=$dst_img; |
|
|
|
@imagedestroy($src_img); |
|
|
|
@imagedestroy($src_img); |
|
|
|
} |
|
|
|
} |
|
|
|