Post by jocle140 » Thu May 03, 2012 2:16 am

When uploading images as main product images in catalog/product/data, the files that i have copied into C:\xampp\htdocs\image\data appear dull with a significant loss of vibrancy and colour. The images appear and open fine in C:\xampp\htdocs\image\data but appear dull and open dull in C:\xampp\htdocs\image\cache\data. I can only get the dull images onto my localhost and website :(.

Please assist!Many thanks for any efforts...

Newbie

Posts

Joined
Wed May 02, 2012 7:11 pm

Post by Avvici » Thu May 03, 2012 3:38 am

You are uploading HIGH RES images and the Open Cart system is resizing them. In resizing them they are compressed to 90 quality which is actually 5 above the average jpg compressed quality. You can change it to 100 by locating this file:system/library/image.php

Then this function:

Code: Select all

 public function save($file, $quality = 90) {
		$info = pathinfo($file);
       
		$extension = strtolower($info['extension']);
   		
		if (is_resource($this->image)) {
			if ($extension == 'jpeg' || $extension == 'jpg') {
				imagejpeg($this->image, $file, $quality);
			} elseif($extension == 'png') {
				imagepng($this->image, $file, 0);
			} elseif($extension == 'gif') {
				imagegif($this->image, $file);
			}
			   
			imagedestroy($this->image);
		}
    }	    
Just adjust the argument $quality = 90

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC
Who is online

Users browsing this forum: No registered users and 55 guests