PHP create image from application/octet stream

前端 未结 3 970
再見小時候
再見小時候 2020-12-17 04:22

My application is having images sent to it from mobile devices with the content-type \"application/octet-stream\".

I need to process these images using the GD librar

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-17 05:06

    you can use this function too. it not require any other dependency. and work perfectly for other types also.

    function _getmime($file){
        if($info = @getimagesize($file)) {
            return image_type_to_mime_type($info[2]);
        } else {
            return mime_content_type($file);
        }
    } 
    

提交回复
热议问题