[eluser]Pierre Sandora[/eluser]
Hello,
Some people had problem with image_lib and your dynamic_output, me too. What happening is that there are contents in buffer when you call
Code:
$this->image_lib->resize();
on function controller. Resize method send headers, but before him CI write in buffer, so image dont display. I try put ob_start and ob_end_flush on index.php, but dont solved.
What solved this problem was put a
Code:
while (@ob_end_clean());
before
Code:
$this->image_lib->resize();
into my controller function.
Code:
function view_image($profile_attribute_id) { //controller function
settype($profile_attribute_id,'integer');
if (!empty($profile_attribute_id)) {
$value = new value_model();
$value->profile_attribute_id = $profile_attribute_id;
$value->load_content();
while (@ob_end_clean());
$config2['image_library'] = 'gd2';
$config2['source_image'] = '../uploads/images/profile/'.$value->file_name;
$config2['maintain_ratio'] = TRUE;
$config2['dynamic_output'] = TRUE;
$config['quality'] = 100;
$config2['width'] = 75;
$config2['height'] = 50;
$this->load->library('image_lib', $config2);
$this->image_lib->resize();
}
}
I call
http://localhost/code/user/view_image/80 and display an image on browser.