Opencart: change image folder

I have OpenCart 1.5.5.1 and tried changing the folder with unexpected results.

My opencart is set to www.example.com/opencart/

I changed config.php and admin/config.phpas follows:

// HTTP
define('HTTP_SERVER', 'http://example.com/opencart/');

// HTTPS
define('HTTPS_SERVER', 'https://example.com/opencart/');

// DIR
define('DIR_APPLICATION', '/home/example/public_html/opencart/catalog/');
define('DIR_SYSTEM', '/home/example/public_html/opencart/system/');
define('DIR_DATABASE', '/home/example/public_html/opencart/system/database/');
define('DIR_LANGUAGE', '/home/example/public_html/opencart/catalog/language/');
define('DIR_TEMPLATE', '/home/example/public_html/opencart/catalog/view/theme/');
define('DIR_CONFIG', '/home/example/public_html/opencart/system/config/');
define('DIR_IMAGE', '/home/example/public_html/opencart/image2/');
define('DIR_CACHE', '/home/example/public_html/opencart/system/cache/');
define('DIR_DOWNLOAD', '/home/example/public_html/opencart/download/');
define('DIR_LOGS', '/home/example/public_html/opencart/system/logs/');

When I look at the site now, all the images are gone, not broken, but gone. After I update the folder name to "image2", the images appear broken, and when I look at the image URL, I see:

 http://example.com/opencart/image/data/Logos/logo.png

So for some reason he is still looking for the "image" folder. When I move the image folder outside the opencart folder, it gets even weirder. from /home/example/public_html/opencart/image2/to/home/example/public_html/image2/

Then the image url:

example.com/opencart/image/data/Logos/logo.png

When I change the HTTP_SERVER line in config.php to http://example.com/opencart2 Images are still broken, but the image URL is now:

example.com/opencart2/image/data/Logos/logo.png

- , ? , DIR_IMAGE , ?

, , , - , , opencart . : 1:

/home/example/public_html/opencart/

2:

/home/example/public_html/opencart2/

:

/home/example/public_html/image/

?

+4
3

.

/catalog/model/tool/image.php

51 && 53 aprox:

return $this->config->get('config_ssl') . 'image/' . $new_image;

return $this->config->get('config_url') . 'image/' . $new_image;

/catalog/controller/common/header.php

24 && 30 Aprox

$this->data['icon'] = $server . 'image/' . $this->config->get('config_icon');
$this->data['logo'] = $server . 'image/' . $this->config->get('config_logo');

.

"" - , DIR_IMAGE.

, .

, Alex

+5

, !

shop1

define ('DIR_IMAGE', '/home/example/public_html/opencart/image/');

Shop2

define ('DIR_IMAGE', '/home/example/public_html/opencart2/image/');

0

, , :

  • define('DIR_IMAGE', '/absolute_path/to/image_folder'); config.php admin/config.php
  • opencart 1.5.6 define('HTTP_IMAGE', 'http://example.com/image_folder/'); define('HTTPS_IMAGE', 'http(s)://example.com/image_path/');
  • image_folder
  • , , (755 image_folder 644 ).
  • /
0

Source: https://habr.com/ru/post/1542586/


All Articles