拿到图片的长宽

 

function get_pic_size($pic_url){
    $size = getimagesize ($pic_url);
    $a=explode(" ",$size[3]);
    foreach ($a as $k=>$v){
        $b=explode("=",$v);
        $b[1]=str_replace('"','', $b[1]);
        $a[$b[0]]=$b[1];
    }
    unset($a[0]);
    unset($a[1]);
    return $a;
}

返回值

array(2) {
  ["width"]=>
  string(5) ""430""
  ["height"]=>
  string(5) ""430""
}

 

单位:px

原文地址:https://www.cnblogs.com/xiaogou/p/11662896.html