opencart/opencart — pull request #1268 by SamStonehouse (2014-03-19 14:31:30+00:00)
Title: Added ability to crop-zoom on image resize

Images can now be resized with zooming rather than adding whitespace around the image. Created method clear_img on the image system library as I reused it.

I added this as images with non-white backgrounds or themes with non-white backgrounds create really bad looking product images with weird looking borders.

I haven't pushed the changes which actually makes this happen to products themselves so without further changes this commit will change nothing but gives the ability to do it further down the line.

Maybe add 'Zoom-in resize' and 'Zoom-out resize' to the image settings in the admin panel for each kind? With zoom-out resize being what is currently used.

Also adds the ability for different resizing to be added later such as
- Only crop
- Ignore ratio

To use this add the third paremeter "resize_and_crop" to the resize method of model_tool_image, e.g.
$this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $width, $height, "resize_and_crop");

Note: The diff looks kinda weird because of the if/else changes as I removed a block, it thinks I added things between when it's a new block completely. Check the whole file rather than the diff