is_image, image_width, image_height, image_type, image_size_str all null

#1
[eluser]s0l1dsnak3123[/eluser]
My function:
Code:
function upload($filetype) {
        $this->load->model('media_gather');
        
        if(isset($_POST['submit'])) {
          /* Create the config for upload library */
          /* (pretty self-explanatory) */
          $config['upload_path'] = './static/upload/'.$filetype; /* NB! create this dir! */
          $config['allowed_types'] = $this->media_gather->get_allowed_filetypes($filetype);
          $config['max_size']  = '0';
          $config['max_width']  = '0';
          $config['max_height']  = '0';
          $config['remove_spaces']  = TRUE;
          $config['overwrite']  = false;
          $config['encrypt_name']  = true;
          /* Load the upload library */
          $this->load->library('upload', $config);

          /* Create the config for image library */
          /* (pretty self-explanatory) */
          $configThumb = array();
          $configThumb['image_library'] = 'gd2';
          $configThumb['source_image'] = '';
          $configThumb['create_thumb'] = TRUE;
          $configThumb['maintain_ratio'] = TRUE;
          /* Set the height and width or thumbs */
          /* Do not worry - CI is pretty smart in resizing */
          /* It will create the largest thumb that can fit in those dimensions */
          /* Thumbs will be saved in same upload dir but with a _thumb suffix */
          /* e.g. 'image.jpg' thumb would be called 'image_thumb.jpg' */
          $configThumb['width'] = 115;
          $configThumb['height'] = 90;
          /* Load the image library */
          $this->load->library('image_lib');

          /* We have 5 files to upload
           * If you want more - change the 6 below as needed
           */
         // for($i = 1; $i < 1; $i++) {
            /* Handle the file upload */
            $upload = $this->upload->do_upload('upload1');

            /* Get the data about the file */
            $data = $this->upload->data();
            
            //$uploadedFiles[0] = $data;
            /* If the file is an image - create a thumbnail */
            print_r($data);
            if($data['is_image'] == 1) {
              $configThumb['source_image'] = './static/upload/'.$filetype.'/'.$data['file_name'];
              //$configThumb['new_image'] = $data['raw_name'].'_thumb'.$data['file_ext'];
              $this->image_lib->initialize($configThumb);
              $this->image_lib->resize();
              
            }
         // }
        } else {
            /* Display the form again */
            $this->load->view('elements/upload_form');
        }
    }

The output of $this->upload->data():
Code:
Array ( [file_name] => 6acee45bbbdf88452aa64b7ac4f263e0.jpg [file_type] => [file_path] => /home/johnhame/domains/johnhamelink.com/public_html/dev/stocky/static/upload/images/ [full_path] => /home/johnhame/domains/johnhamelink.com/public_html/dev/stocky/static/upload/images/6acee45bbbdf88452aa64b7ac4f263e0.jpg [raw_name] => 6acee45bbbdf88452aa64b7ac4f263e0 [orig_name] => Desk_1_003.jpg [file_ext] => .jpg [file_size] => 19.56 [is_image] => [image_width] => [image_height] => [image_type] => [image_size_str] => )

Because of
Code:
[is_image] =>
I can't detect if a thumbnail should be created... I'm pretty sure this is a server problem.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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