CodeIgniter Forums

Full Version: Timthumb for CodeIgniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum


Is there anything similar or Timthumb version for Codeigniter? Well basically I need to only specify the size for image and cropping, I don't need to create another file (thumbnail), since I'm taking images from image server that is on different server, than website is.

El Forum

You can use a simple image controller to do this with the [url=""]Image Library[/url]. I have done something like this:
class Image extends CI_Controller
  public function index($width = 100, $height = 100, $image_path)
     $config['image_library'] = 'gd2';
     $config['source_image'] = $image_ath;
     $config['dynamic_output'] = TRUE;
     $config['maintain_ratio'] = TRUE;
     $config['width'] = $width;
     $config['height'] = $height;

     $this->load->library('image_lib', $config);
     echo $this->image_lib->resize();

//Call from view
<img src="image/100/100/my-image.jpg" alt="" />

Using the image class is pretty simple to write a resize or crop image handler.

El Forum

check out imageMoo !

El Forum

Like ^^ Smile