feat: change image crop algorythm for product view page
This commit is contained in:
@@ -7,7 +7,7 @@ services:
|
||||
- "./scripts:/scripts"
|
||||
- "./module:/module"
|
||||
- "./build:/build"
|
||||
- "/Users/nikitakiselev/code/italy-moda/image/catalog:/web/upload/image/catalog"
|
||||
# - "/Users/nikitakiselev/code/italy-moda/image/catalog:/web/upload/image/catalog"
|
||||
ports:
|
||||
- "8000:80"
|
||||
restart: always
|
||||
|
||||
@@ -430,8 +430,11 @@ class ProductsService
|
||||
|
||||
public function getProductImages(int $productId): array
|
||||
{
|
||||
$imageThumbWidth = 500;
|
||||
$imageThumbHeight = 500;
|
||||
$aspectRatio = $this->settings->get('app.image_aspect_ratio', '1:1');
|
||||
$cropAlgorithm = $this->settings->get('app.image_crop_algorithm', 'cover');
|
||||
|
||||
[$imageWidth, $imageHeight] = ImageUtils::aspectRatioToSize($aspectRatio);
|
||||
|
||||
$imageFullWidth = 1000;
|
||||
$imageFullHeight = 1000;
|
||||
|
||||
@@ -456,9 +459,8 @@ class ProductsService
|
||||
try {
|
||||
[$width, $height] = $this->image->make($imagePath)->getRealSize();
|
||||
$images[] = [
|
||||
'thumbnailURL' => $this->image
|
||||
->make($imagePath)
|
||||
->contain($imageThumbWidth, $imageThumbHeight)
|
||||
'thumbnailURL' => $this->image->make($imagePath)
|
||||
->crop($cropAlgorithm, $imageWidth, $imageHeight)
|
||||
->url(),
|
||||
'largeURL' => $this->image->make($imagePath)->resize($imageFullWidth, $imageFullHeight)->url(),
|
||||
'width' => $width,
|
||||
|
||||
Reference in New Issue
Block a user