【问题标题】:image uploading works properly with all devices except iphone图像上传适用于除 iphone 以外的所有设备
【发布时间】:2020-05-29 22:43:06
【问题描述】:

php (codeigniter):图片上传在所有设备上正常工作,但在 iphone 设备上工作

仅上传 iphone 捕获的图像,但不适用于非捕获/其他图像

我的代码片段: (代码太长,我只是部分代码)

<?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;
    }
    ....
    ....
?>

以上 php (codeigniter) 脚本适用于所有设备,但不适用于 iphone

请向我提出解决此问题的更改或想法。

【问题讨论】:

标签: php ios iphone codeigniter


【解决方案1】:

在 windows 或 android.. "jpg" 自动考虑为 "jpeg"。但是对于 iPhone,你必须在“allow-types”中单独提及它

【讨论】:

    猜你喜欢
    • 2020-07-08
    • 1970-01-01
    • 2019-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-23
    • 2014-06-12
    • 1970-01-01
    相关资源
    最近更新 更多