Home » Php » php – image uploading works properly with all devices except iphone

php – image uploading works properly with all devices except iphone

Posted by: admin February 25, 2020 Leave a comment

Questions:

php (codeigniter): image uploading working properly in all devices but on working on iphone devices

Only iphone-captuered images are getting uploaded, but not working for non-captured/other images

My Code Snippet:
(too lengthy code, I am just some part of that code)

<?php
    .....
    .....  
    $this->load->library("upload");
    $this->upload->initialize($this->set_upload_options()); 

    if($this->upload->do_upload()){

          $ppimagedata = $this -> upload -> data();
          $ppnewimagename = $ppimagedata["file_name"];

          $this -> load -> library("image_lib");
          $config['image_library']   = 'gd2';
          $config['source_image']    = $ppimagedata["full_path"];
          $config['create_thumb']    = TRUE;
          $config['maintain_ratio']  = FALSE;

          $config['new_image']    = './uploads/Property/300X300/';
          $config['width']       = 300;
          $config['height']       = 300;
          $this -> image_lib -> initialize($config);
          $this -> image_lib -> resize();
    }  

    private function set_upload_options() {     
        $config = array ();
        $config ['upload_path'] = './uploads/Property';
        $config ['allowed_types'] = 'gif|jpg|png';  
        return $config;
    }
    ....
    ....
?>

above php (codeigniter) script working properly for all devices but not working for iphone

Please suggest me the changes or idea to resolve this issue.

How to&Answers:

In windows or android.. “jpg” auto-consider as “jpeg”. But for iPhone, you have to mention it separately in “allow-types”