1

I'm writing a PyroCMS module which involves image upload and thumbnail generation. I'm aware codeigniter has a built in image manipulation class that's capable of making thumbnails, but I'm a big for of phpThumb'ss adaptive resize function. For this reason I'd like to try and get phpThumb working.

I've placed the phpThumb files in ./addons/shared_addons/modules/mymodule/libraries

and I'm trying to load using the following:

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

I'm including the extension because an .inc.php file is not a .php file right? Either way if I keep the extension or not I get this error:

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

Anyone know what I'm doing wrong?

Thanks, Ed.

edhardie
  • 299
  • 1
  • 5
  • 15

2 Answers2

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.

Nick Pyett
  • 3,338
  • 1
  • 23
  • 27
  • 1
    Yes, Pyro doesn't like the .inc.php stuff... `$this->load->library('phpThumb/Thumblib');` with the filename being Thumblib.php and class name Thumblib should do the trick. – stormdrain Feb 16 '12 at 16:19
3

This is a CodeIgniter question, not a PyroCMS question.

Simple solution:

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

Remember guys it's just PHP. You don't need a special method for everything!

Phil Sturgeon
  • 30,637
  • 12
  • 78
  • 117