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

how can i resize image then directly displayed in the browser..?

// 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);

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

cool thanks...

setting dynamic_output to TRUE does the trick for me

$config['dynamic_output'] = TRUE;

thanks again

Theme © iAndrew 2016 - Forum software by © MyBB