|
@@ 995-999 (lines=5) @@
|
| 992 |
|
* @param null $previewHeight |
| 993 |
|
*/ |
| 994 |
|
private function cropAndFill($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight) { |
| 995 |
|
if ($previewWidth > $askedWidth) { |
| 996 |
|
$cropX = floor(($previewWidth - $askedWidth) * 0.5); |
| 997 |
|
$image->crop($cropX, 0, $askedWidth, $previewHeight); |
| 998 |
|
$previewWidth = $askedWidth; |
| 999 |
|
} |
| 1000 |
|
|
| 1001 |
|
if ($previewHeight > $askedHeight) { |
| 1002 |
|
$cropY = floor(($previewHeight - $askedHeight) * 0.5); |
|
@@ 1001-1005 (lines=5) @@
|
| 998 |
|
$previewWidth = $askedWidth; |
| 999 |
|
} |
| 1000 |
|
|
| 1001 |
|
if ($previewHeight > $askedHeight) { |
| 1002 |
|
$cropY = floor(($previewHeight - $askedHeight) * 0.5); |
| 1003 |
|
$image->crop(0, $cropY, $previewWidth, $askedHeight); |
| 1004 |
|
$previewHeight = $askedHeight; |
| 1005 |
|
} |
| 1006 |
|
|
| 1007 |
|
// Creates a transparent background |
| 1008 |
|
$backgroundLayer = imagecreatetruecolor($askedWidth, $askedHeight); |