2012-05-07 8 views

答えて

0
public function show_image(){ 
$config['image_library'] = 'gd2'; 
$config['source_image'] = '/path/to/image/mypic.jpg'; 
$config['dynamic_output'] = TRUE; 
//Determines whether the new image file should be written to disk or generated dynamically. Note: If you choose the dynamic setting, only one image can be shown at a time, and it can't be positioned on the page. It simply outputs the raw image dynamically to your browser, along with image headers. 
$this->load->library('image_lib', $config); 

$this->image_lib->resize(); 

} 
1
public function show_image($image){ 

    $image_path = APPPATH . 'media/'; 

    if(file_exists($image_path . $image . '.jpeg')) 
    { 
     $this->output 
       ->set_content_type('jpeg') 
       ->set_output(file_get_contents($image_path . $image . '.jpeg')); 
    } 
    else 
     show_404(); 
} 
関連する問題