Opencart (ocStore) 1.5 x – crop images (thumbnail)

opencart crop thumbnailContinue to expand the capabilities of the beloved Opencart (ocStore) 1.5 x – in this article will configure the engine to frame (crop) thumbnail of products and categories, and thereby get rid of ugly white streaks in the images of the product and preview categories.

Crop images in therefore, it can be implemented differently, in this example, will do this without connecting third-party modules and libraries, using the edit original files of engine.

 
the

1.Opencart (ocStore) 1.5 x crop images globally:

In this way all images on the website and all modules will be circumcised according to the tinctures specified in the admin panel. In the file

catalog/model/tool/image.php

change the whole function:

public function resize($filename, $width, $height, $type = “”) {

On:

Then cleaned the folder with the thumbnail cache. After that, the website will show cropped image thumbnails without white bands.
the

2. Setting custom image cropping for different oxbow lakes in therefore,

The next option will be useful if we, for example, it is necessary that the goods pictures kadrirovanie, and headings were derived using a standard method. I.e. implement a custom crop for different pages or specific modules. This editable file is the same file.

catalog/model/tool/image.php

Only this time do not touch the function of resis, and before it add their:

And then the appropriate files in a page controller or module find lines of image processing, such:

$this->model_tool_image->resize(

and model on

$this->model_tool_image->mycrop(

And then also, do not forget to clean the cache folder of pictures.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *