1

我正在编写一个涉及图像上传和缩略图生成的 PyroCMS 模块。我知道 codeigniter 有一个内置的图像处理类,它能够制作缩略图,但我很喜欢 phpThumb 的自适应调整大小功能。出于这个原因,我想尝试让 phpThumb 正常工作。

我已将 phpThumb 文件放在 ./addons/shared_addons/modules/mymodule/libraries

我正在尝试使用以下内容加载:

$this->load->library('phpThumb/ThumbLib.inc.php');

我包含扩展名是因为 .inc.php 文件不是 .php 文件,对吗?无论哪种方式,如果我保留扩展名,我都会收到此错误:

Class 'ThumbLib.inc.php' not found in .../htdocs/system/cms/libraries/MX/Loader.php on line 160

有人知道我在做什么错吗?

谢谢,埃德。

4

2 回答 2

4

The loader naming conventions are probably stricter, so you may need to rename your file to something like 'Thumblib.php' and then declare your class as so class Thumblib {. You may also need to check the library doesn't conflict with anything as is suitable to use in CI.

Also, I think as long as you are loading the library from a controller in the same module folder tree as the library, the load line should be something like:

$this->load->library('Thumblib');

Or if not:

$this->load->library('othermodule/Thumblib');

Good luck.

于 2012-02-16T15:56:31.993 回答
3

这是一个 CodeIgniter 问题,而不是 PyroCMS 问题。

简单的解决方案:

 include 'whatever/the/hell/you.like.php';

请记住,这只是 PHP。你不需要任何特殊的方法!

于 2012-02-20T22:43:29.197 回答