use transparent background instead of white
This commit is contained in:
@@ -78,12 +78,12 @@ class StoreUploadedFileJob implements ShouldQueue
|
|||||||
if ($fileExtension === 'heic') {
|
if ($fileExtension === 'heic') {
|
||||||
// Get the path without the file name
|
// Get the path without the file name
|
||||||
$uploadedFileDirectory = dirname($this->uploadedFilePath);
|
$uploadedFileDirectory = dirname($this->uploadedFilePath);
|
||||||
|
|
||||||
// Convert the HEIC file to JPG
|
// Convert the HEIC file to JPG
|
||||||
$jpgFileName = pathinfo($this->uploadedFilePath, PATHINFO_FILENAME) . '.jpg';
|
$jpgFileName = pathinfo($this->uploadedFilePath, PATHINFO_FILENAME) . '.jpg';
|
||||||
$jpgFilePath = $uploadedFileDirectory . '/' . $jpgFileName;
|
$jpgFilePath = $uploadedFileDirectory . '/' . $jpgFileName;
|
||||||
Image::make($this->uploadedFilePath)->save($jpgFilePath);
|
Image::make($this->uploadedFilePath)->save($jpgFilePath);
|
||||||
|
|
||||||
// Update the uploaded file path and file name
|
// Update the uploaded file path and file name
|
||||||
$this->uploadedFilePath = $jpgFilePath;
|
$this->uploadedFilePath = $jpgFilePath;
|
||||||
$fileName = $jpgFileName;
|
$fileName = $jpgFileName;
|
||||||
@@ -155,6 +155,7 @@ class StoreUploadedFileJob implements ShouldQueue
|
|||||||
$image->resize($size['width'], $size['height'], function ($constraint) {
|
$image->resize($size['width'], $size['height'], function ($constraint) {
|
||||||
$constraint->aspectRatio();
|
$constraint->aspectRatio();
|
||||||
$constraint->upsize();
|
$constraint->upsize();
|
||||||
|
$constraint->background('rgba(0,0,0,0)'); // Set transparent background
|
||||||
});
|
});
|
||||||
$image->resizeCanvas($size['width'], $size['height'], 'center', false, '#FFFFFF');
|
$image->resizeCanvas($size['width'], $size['height'], 'center', false, '#FFFFFF');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user