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