|
@@ 1001-1005 (lines=5) @@
|
| 998 |
|
* @param int $previewHeight |
| 999 |
|
*/ |
| 1000 |
|
private function cropAndFill($image, $askedWidth, $askedHeight, $previewWidth, $previewHeight) { |
| 1001 |
|
if ($previewWidth > $askedWidth) { |
| 1002 |
|
$cropX = floor(($previewWidth - $askedWidth) * 0.5); |
| 1003 |
|
$image->crop($cropX, 0, $askedWidth, $previewHeight); |
| 1004 |
|
$previewWidth = $askedWidth; |
| 1005 |
|
} |
| 1006 |
|
|
| 1007 |
|
if ($previewHeight > $askedHeight) { |
| 1008 |
|
$cropY = floor(($previewHeight - $askedHeight) * 0.5); |
|
@@ 1007-1011 (lines=5) @@
|
| 1004 |
|
$previewWidth = $askedWidth; |
| 1005 |
|
} |
| 1006 |
|
|
| 1007 |
|
if ($previewHeight > $askedHeight) { |
| 1008 |
|
$cropY = floor(($previewHeight - $askedHeight) * 0.5); |
| 1009 |
|
$image->crop(0, $cropY, $previewWidth, $askedHeight); |
| 1010 |
|
$previewHeight = $askedHeight; |
| 1011 |
|
} |
| 1012 |
|
|
| 1013 |
|
// Creates a transparent background |
| 1014 |
|
$backgroundLayer = imagecreatetruecolor($askedWidth, $askedHeight); |