feat(shop): change grid image resize algorythm

This commit is contained in:
2025-08-03 17:19:09 +03:00
parent 133badf45b
commit c3c2561932
3 changed files with 9 additions and 7 deletions

View File

@@ -60,7 +60,6 @@ class ControllerExtensionModuleTgshop extends Controller
public function index(): void public function index(): void
{ {
$this->load->language('extension/module/tgshop');
$this->load->model('setting/setting'); $this->load->model('setting/setting');
$hasConfig = $this->config->get('module_tgshop_app_name') !== null; $hasConfig = $this->config->get('module_tgshop_app_name') !== null;
@@ -182,6 +181,7 @@ class ControllerExtensionModuleTgshop extends Controller
private function baseData(array &$data): void private function baseData(array &$data): void
{ {
$this->load->language('extension/module/tgshop');
$this->document->setTitle($this->language->get('heading_title')); $this->document->setTitle($this->language->get('heading_title'));
$data['header'] = $this->load->controller('common/header'); $data['header'] = $this->load->controller('common/header');

View File

@@ -44,10 +44,12 @@ class ImageTool implements ImageToolInterface
mkdir($dirPath, 0777, true); mkdir($dirPath, 0777, true);
} }
$image = $this->manager->make($fullOldPath)->resize($width, $height, function ($constraint) { $image = $this->manager->make($fullOldPath)
->resize($width, $height, function ($constraint) {
$constraint->aspectRatio(); $constraint->aspectRatio();
$constraint->upsize(); $constraint->upsize();
}); })
->resizeCanvas($width, $height, 'center', false, null);
$image->encode($format, 75)->save($fullNewPath, 75, $format); $image->encode($format, 75)->save($fullNewPath, 75, $format);
} }

View File

@@ -53,8 +53,8 @@ class ProductsHandler
$featuredProducts = $this->settings->get('featured_products'); $featuredProducts = $this->settings->get('featured_products');
$mainpageProducts = $this->settings->get('mainpage_products'); $mainpageProducts = $this->settings->get('mainpage_products');
$imageWidth = 200; $imageWidth = 184;
$imageHeight = 200; $imageHeight = 245;
if ($categoryId) { if ($categoryId) {
$categoryName = $this->queryBuilder->newQuery() $categoryName = $this->queryBuilder->newQuery()