Jump to content

Move IMG folder to another hard disk


Petter Enge

Recommended Posts

Hello

I am running Prestashop 1.7.7.3 under Debian10/NGINX

I have two drives (SSD and HDD)
The SSD is small so I would like to run the software from there and have IMG folder on the HDD.

How can I manage that ?
I think it has something to do with config.inc.php ?

Here are my paths from root:

/www/wwwroot/panel_ssl_site/(prestashop files)

my HDD is

/drive2/

Hope someone can help me modifying the file(s).

 

Regards

Petter

 

Edited by Petter Enge (see edit history)
Link to comment
Share on other sites

5 hours ago, Petter Enge said:

Hello

I am running Prestashop 1.7.7.3 under Debian10/NGINX

I have two drives (SSD and HDD)
The SSD is small so I would like to run the software from there and have IMG folder on the HDD.

How can I manage that ?
I think it has something to do with config.inc.php ?

Here are my paths from root:

/www/wwwroot/panel_ssl_site/(prestashop files)

my HDD is

/drive2/

Hope someone can help me modifying the file(s).

 

Regards

Petter

 

That could help you out

 

Link to comment
Share on other sites

 @ndiaga I think we do not change the image _PS_IMG_DIR_ folder path then category and other controller will not find image path as they directly access _PS_IMG_DIR_

define('_PS_CAT_IMG_DIR_', _PS_IMG_DIR_.'c/');

 

So the final solution is for location is

 

if (!defined('_PS_IMG_DIR_')) {
    $new_path = '/Users/mac/Sites/localhost/ps/new-img-1.7.7.0' ;
    define('_PS_IMG_DIR_',  $new_path .'/img/');
}
if (!defined('_PS_HOST_MODE_')) {
    echo realpath($currentDir.'/..');

    $new_path = '/Users/mac/Sites/localhost/ps/new-img-1.7.7.0' ;

    define('_PS_CORE_IMG_DIR_', $new_path.'/img/');
} else {
    define('_PS_CORE_IMG_DIR_', $new_path.'/img/');
}

 

Another challenge i face  the .httaccess where the image url is accessible  like 

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]

So the image is not found. 

 

In my opinion it is better to use PrestaShop media server , move image to new sub domain which point to that hdd.   What you think

 

Thank you

Link to comment
Share on other sites

13 minutes ago, ndiaga said:

You  still have  the  path  available  from  any  other  place  once  you  define     _PS_IMG_DIR_ 

Yes, this what i also told. Need to change the this variable path other wise other variable will not work. But did you check after the change the location it work . In my case the image failed to load as they try to find the image from /img folder due to .httaccess rules.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...