On Codeigniter, I'm using phpThumb to generate images. I didn't use the built-in CI image library because it couldn't do the "zoom-crop" feature of phpThumb, which I badly need (ability to create thumbnails of the same size regardless of their original size/proportions, by zooming and cropping when necessary).
Everything is working fine except my images' src
look so ugly:
<img src="lib/phpThumb.php?src=../../upload/photo/file.jpg&w=100&h=100&zc=1" />
I was hoping to make it look something like this instead:
<img src="photo/display/file.jpg" />
by wrapping phpThumb in a CI controller photo
with the method display($filename) {}
I was able to do this using the built-in CI image library, but I'm at a loss on how to use phpThumb instead.
Any suggestions?
I found a different PHP thumbnailing library (also called PHPThumb) and used it: https://github.com/masterexploder/PHPThumb/wiki
Here's my CodeIgniter class:
class Photo extends CI_Controller {
function __construct() {
parent::__construct();
}
function display($filename) {
require_once('./lib/PHPThumb/ThumbLib.inc.php');
$thumb = PhpThumbFactory::create('./upload/photo/' . $filename);
$thumb->adaptiveResize(100, 100);
$thumb->show();
}
}
Now my img
looks better:
<img src="photo/display/file.jpg" />