• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Image Resize

#1
how to resize the picture ?

350x200 

PHP Code:
   public function insert_news()
 
   {

    
$config['upload_path'      'uploads/news/';
 
       $config['allowed_types'    'gif|jpg|png';
 
       $config['encrypt_name']      = TRUE;

 
       $this->load->library('upload'$config);

 
       if ($this->upload->do_upload('news_image'))
 
       {
 
            
        $image         
$this->upload->data();
        
$image_url     $image['file_name'];
        
$db_insert     ='upload/news/'.$image_url.'';


        
$data=array(
     
         'news_title'     => $this->input->post('news_title'),
     
         'news_content'    => $this->input->post('news_content'),
     
         'news_image'    =>    $db_insert,
     
            'news_sef'=>sef($this->input->post('news_title'))
        );

        
$this->load->model('vt');
        
$result $this->vt->insert_news($data);
        if (
$result) {
            echo 
"yes";
        }else

        {
            echo 
"no";
        }

 
         
    

Reply

#2
Maybe use this code,
if you any problem read this link bro https://stackoverflow.com/questions/1921...age-resize

On view use this:

foreach($results as $row)
{

$config['image_library'] = 'gd2';
$config['source_image'] = '/img/proizvodi/'.$row->proizvodid.'.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;


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

#3
(11-02-2017, 08:16 PM)bgr06 Wrote: how to resize the picture ?

350x200 

PHP Code:
   public function insert_news()
 
   {

    
$config['upload_path'      'uploads/news/';
 
       $config['allowed_types'    'gif|jpg|png';
 
       $config['encrypt_name']      = TRUE;

 
       $this->load->library('upload'$config);

 
       if ($this->upload->do_upload('news_image'))
 
       {
 
            
        $image         
$this->upload->data();
        
$image_url     $image['file_name'];
        
$db_insert     ='upload/news/'.$image_url.'';


        
$data=array(
     
         'news_title'     => $this->input->post('news_title'),
     
         'news_content'    => $this->input->post('news_content'),
     
         'news_image'    =>    $db_insert,
     
            'news_sef'=>sef($this->input->post('news_title'))
        );

        
$this->load->model('vt');
        
$result $this->vt->insert_news($data);
        if (
$result) {
            echo 
"yes";
        }else

        {
            echo 
"no";
        }

 
         
    


check this if problem occured : https://stackoverflow.com/questions/4326...oblem?rq=1
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.