Opencart product images are not displayed, "src(unknown)"

时间:2017-08-05 10:46:28

标签: php html image opencart

I am creating test environment for my opencart installation. I downloaded all files and imported database too from live server. I am using XAMPP local server. All functions are working properly. But the product images are not displayed. Other images like logo, icons are displayed and images in admin panel are also displayed. Just product images are not visible. When I inspect the image tag on browser the src field is set to unknown.

<img src(unknown) alt="Sony Xperia L1 4G 16 GB Mobile Phone | Pink" title="Sony Xperia L1 4G 16 GB Mobile Phone | Pink" class="img-responsive">

I tried on different browser but the issue is still same.

1 个答案:

答案 0 :(得分:2)

In config.php check the path for DIR_IMAGE. You are using relative path.

It should be

define('DIR_IMAGE', 'C:/xampp/htdocs/project_name/image/');

For all the CONSTANTS absolute path should be used while working on local server and Opencart. So other CONSTANTS will also change as

define('DIR_APPLICATION', 'C:/xampp/htdocs/project_name/catalog/');
define('DIR_SYSTEM', 'C:/xampp/htdocs/project_name/system/');
define('DIR_LANGUAGE', 'C:/xampp/htdocs/project_name/catalog/language/');
define('DIR_TEMPLATE', 'C:/xampp/htdocs/project_name/catalog/view/theme/');
define('DIR_CONFIG', 'C:/xampp/htdocs/project_name/system/config/');
define('DIR_CACHE', 'C:/xampp/htdocs/project_name/system/storage/cache/');
define('DIR_DOWNLOAD', 'C:/xampp/htdocs/project_name/system/storage/download/');
define('DIR_LOGS', 'C:/xampp/htdocs/project_name/system/storage/logs/');
define('DIR_MODIFICATION', 'C:/xampp/htdocs/project_name/system/storage/modification/');
define('DIR_UPLOAD', 'C:/xampp/htdocs/project_name/system/storage/upload/');