Welcome Guest, Not a member yet? Register   Sign In
image resize
#2

[eluser]xwero[/eluser]
Code:
// controller
$file = 'new_image.jpg'
$newpath = '/path/to/'.$file;
if(!file_exist($newpath)) // check for not generating rezized images multiple times
{
   $config['image_library'] = 'GD';
   $config['source_image'] = '/path/to/image/mypic.jpg';
   $config['create_new'] = $newpath; // keeps oringinal
   $config['maintain_ratio'] = TRUE;
   $config['width'] = 75;
   $config['height'] = 50;

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

   $this->image_lib->resize();
}
$data['resizedurl'] = base_url().'to/path/'.$file;
$this->load->view('view',$data);
// view
<img src="&lt;?php echo $resizedurl; ?&gt;">
You can make it more dynamic but i think you can get the picture


Messages In This Thread
image resize - by El Forum - 01-10-2008, 02:51 AM
image resize - by El Forum - 01-10-2008, 03:03 AM
image resize - by El Forum - 01-10-2008, 03:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB