Showing posts with label Crop product image or remove white space. Show all posts
Showing posts with label Crop product image or remove white space. Show all posts

Friday, 11 July 2014

Remove white space from Image in Opencart


Remove white space from Image in Opencart

Note : vqmod need to be install to fix this issue...

Create a xml file named white-space.xml and paste belowe code in this xml file...

<modification>
<id><![CDATA[Fixes white excess for non-proportional image resize]]></id>
<version><![CDATA[1.0]]></version>
<vqmver><![CDATA[]]></vqmver>
<file name="system/library/image.php">
<operation>
<search position="replace"><![CDATA[$this->image = imagecreatetruecolor($width, $height);]]></search>
<add><![CDATA[$this->image = imagecreatetruecolor($new_width, $new_height); /* MX]]></add>
</operation>
<operation>
<search position="replace" offset="4"><![CDATA[imagecopyresampled($this->image, $image_old, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']);]]></search>
<add><![CDATA[MX */
imagecopyresampled($this->image, $image_old, 0, 0, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']);

imagedestroy($image_old);
         
$this->info['width']  = $new_width;
$this->info['height'] = $new_height;
// MX End ]]></add>
</operation>
</file>
</modification>

Now open your opencart directory go to vqmod/xml and paste here above xml file..

That's it enjoy chandresh rana coding... :)