I have uploaded an image with the resolution 1600x1200. How can I show users 60x60 and 200x200 without creating thumbnails and uploading again. (like phpthumb library) in CodeIgniter?
How to use timThumb? tutorial or documentation?
zarpio
2010-07-27 21:36:07
http://www.darrenhoyt.com/2008/04/02/timthumb-php-script-released/ (the tutorial)
Mike
2010-07-28 20:07:30
He really needs to add some anti-spam measurements to his forum
stef
2010-07-29 12:50:38
+1
A:
Codeigniter comes with its own image library which can resize images. This example is from the documentation, just edit the $config variable:
$config['image_library'] = 'gd2';
$config['source_image'] = '/path/to/image/mypic.jpg';
$config['new_image'] = '/path/to/new/image.jpg';
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
You can also create thumbnails dynamically (that is, without saving them to the hard drive) but that requires a lot of memory so I would discourage that.
The image class can also crop the image if you need that. I use it to create thumbnails in the application I am currently working on...
Visit the documentation: http://codeigniter.com/user_guide/libraries/image_lib.html
Calle
2010-07-29 10:48:44