|
@@ 982-986 (lines=5) @@
|
| 979 |
|
* @param int $previewHeight |
| 980 |
|
*/ |
| 981 |
|
private function cropAndFill($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight) { |
| 982 |
|
if ($previewWidth > $askedWidth) { |
| 983 |
|
$cropX = \floor(($previewWidth - $askedWidth) * 0.5); |
| 984 |
|
$image->crop($cropX, 0, $askedWidth, $previewHeight); |
| 985 |
|
$previewWidth = $askedWidth; |
| 986 |
|
} |
| 987 |
|
|
| 988 |
|
if ($previewHeight > $askedHeight) { |
| 989 |
|
$cropY = \floor(($previewHeight - $askedHeight) * 0.5); |
|
@@ 988-992 (lines=5) @@
|
| 985 |
|
$previewWidth = $askedWidth; |
| 986 |
|
} |
| 987 |
|
|
| 988 |
|
if ($previewHeight > $askedHeight) { |
| 989 |
|
$cropY = \floor(($previewHeight - $askedHeight) * 0.5); |
| 990 |
|
$image->crop(0, $cropY, $previewWidth, $askedHeight); |
| 991 |
|
$previewHeight = $askedHeight; |
| 992 |
|
} |
| 993 |
|
|
| 994 |
|
// Creates a transparent background |
| 995 |
|
$backgroundLayer = \imagecreatetruecolor($askedWidth, $askedHeight); |