diff --git a/app/Jobs/Tasks/SaveShopeeSellerImagesTask.php b/app/Jobs/Tasks/SaveShopeeSellerImagesTask.php index 2fc3c37..6ecd462 100644 --- a/app/Jobs/Tasks/SaveShopeeSellerImagesTask.php +++ b/app/Jobs/Tasks/SaveShopeeSellerImagesTask.php @@ -188,9 +188,17 @@ private static function filterImages(array $images, string $proxy, string $user_ $sizeKb = round(strlen($imageData) / 1024, 2); // Check constraints - if ($width < 800 || $height < 800 || $sizeKb < 100 || $mime !== 'image/jpeg') { + if ($width < 300 || $height < 300) { continue; } + + $interventionImage->resize(800, null, function ($constraint) { + $constraint->aspectRatio(); + }); + $width = $interventionImage->width(); + $height = $interventionImage->height(); + $mime = $interventionImage->mime(); + $image['width'] = $width; $image['height'] = $height; $image['mime'] = $mime; diff --git a/app/Jobs/Tasks/UrlCrawlerTask.php b/app/Jobs/Tasks/UrlCrawlerTask.php index 41a3853..4ba641e 100644 --- a/app/Jobs/Tasks/UrlCrawlerTask.php +++ b/app/Jobs/Tasks/UrlCrawlerTask.php @@ -244,9 +244,17 @@ private static function filterImages(array $images, string $proxy, string $user_ $sizeKb = round(strlen($imageData) / 1024, 2); // Check constraints - if ($width < 800 || $height < 800 || $sizeKb < 100) { + if ($width < 300 || $height < 300) { continue; } + + $interventionImage->resize(800, null, function ($constraint) { + $constraint->aspectRatio(); + }); + $width = $interventionImage->width(); + $height = $interventionImage->height(); + $mime = $interventionImage->mime(); + $image['width'] = $width; $image['height'] = $height; $image['mime'] = $mime;