OpenCart Image Cache Permission 600 Error Fix

OpenCart Image Cache Permission 600 Error Fix 

on godaddy hosting, because the image files saved into the cache is constantly being set at permission 600, the file cannot be read by the browser. we need to change opencart to make it force the cache to be permission 755.

1) Go to system/library/
2) Edit the image.php

3) Find this:

public function save($file, $quality = 90) {
$info = pathinfo($file);

$extension = strtolower($info[‘extension’]);

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);

4) Add this line: chmod($file, 0755);

5) It becomes the following

public function save($file, $quality = 90) {
$info = pathinfo($file);

$extension = strtolower($info[‘extension’]);

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);
}
chmod($file, 0755);
imagedestroy($this->image);

6) Save file. Done!

Related Articles

1 Response

  1. Diffus says:

    This solution does not work when the image does not need to be resized.
    As an example, if you upload a baners at the exact display size.

Leave a Reply

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