更新时间:2022-11-02 14:23:55
首先,我会保留默认的大小调整工具,因为在某些情况下它可能会派上用场.我所做的是添加了两个功能来调整图像大小.
First of all I would leave the default resizing tool as in some circumstances it might come in handy. What I did was add two more functions to resize images.
一个功能可以裁剪图像,使其适合管理员设置的尺寸.现在添加了空白区域.这是伟大的产品清单.我添加的第二个功能是调整图像大小的功能,因此最大尺寸将设置为在管理员中设置的最大尺寸.它将按比例缩放.
One function that crops an image so it fits the size set in the admin. Now empty white areas are added. This one is great for product lists. The second I added is a function that resizes an image so the biggest dimension will be set to the max size set in the admin. It will be scaled proportionally.
新文件发布在OpenCart论坛帖子中.
我将两个额外的功能命名为 cropsize 和 onesize .您要做的就是在控制器中找到使用的调整大小功能并进行以下调整:
I named the two extra functions cropsize and onesize. All you have to do is find the used resize functions in the controller and adjust this:
'thumb' => $this->model_tool_image
->resize($image,
$this->config->get('config_image_category_width'),
$this->config->get('config_image_category_height')));
收件人:
'thumb' => $this->model_tool_image
->cropsize($image,
$this->config->get('config_image_category_width'),
$this->config->get('config_image_category_height')));
onesize函数仅需要一个参数,因此由您自己决定,但是您可以使用类似以下的方法:
The onesize function only needs one parameter so it's up to you but you could use something like this:
'popup' => $this->model_tool_image
->onesize($result['image'],
$this->config->get('config_image_popup_width'))
我希望这会帮助您获得更好的图像.
I hope this will help you getting better images.