在另一个目录中使用Prestashop的Image类


Use the Image class of Prestashop in another directory

我面临着一些看似简单的事情,但我只是被卡住了!

我正在尝试使用Prestashop的Image类(在我的脚本中)来处理图像的大小调整。(之后使用)。

所以,

我的脚本位于:

EDI/modules/Article

图片类在classes

因此,如果我想使用脚本中的图片类,我会这样做:

include_once (ROOT_PATH . '/config/config.inc.php');
include_once (ROOT_PATH . '/classes/Image.php');

php说:

致命错误:调用…中未定义的方法DB::getInstance()/config/alias.php在第65行

这来自

function pSQL($string, $htmlOK = false)
{
    // Avoid thousands of "Db::getInstance()"...
    static $db = false;
    
    if (!$db)
        $db = Db::getInstance(); <============= HERE 
    return $db->escape($string, $htmlOK);
}

为什么??包含config.inc.php不是要让它工作吗?

我只想(从现在起)能够做一些事情,比如:

$images_types = ImageType::getImagesTypes('products'); 
var_dump($images_types);

我们有一个博客智能博客,其中包括类似config.php的以下代码

require_once(dirname(__FILE__).'../../../config/config.inc.php');
require_once(dirname(__FILE__).'../../../init.php');

https://github.com/smartdatasoft/smartblog