图片上传可以在除iPhone之外的所有设备上正常使用 [英] image uploading works properly with all devices except iphone

查看:55
本文介绍了图片上传可以在除iPhone之外的所有设备上正常使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

php(codeigniter):图像上传在所有设备上均可正常运行,但可在iphone设备上正常运行

仅受iphone捕获图片已上传,但不适用于未捕获的图片/其他图片

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

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

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

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.

推荐答案

在Windows或android .. jpg自动视为 jpeg。但是对于iPhone,您必须在允许类型中单独提及它

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

这篇关于图片上传可以在除iPhone之外的所有设备上正常使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆