急周六周天都在加班弄这个有关问题,怎样获取上传图片的长度宽度

WBOY
Release: 2016-06-13 12:09:43
Original
887 people have browsed it

急急急,在线等,周六周天都在加班弄这个问题,怎样获取上传图片的长度宽度
怎样获取上传图片的长度和宽度
list( $width ,  $height ,  $type ,  $attr ) = getimagesize(' http://192.168.254.20/Public/images/0.jpg');
         echo $width;
         echo $height;
        echo $attr;


        $img = imagecreatefromjpeg("http://http://192.168.254.20/Public/images/0.jpg");
         echo  imagesx( $img );
     echo "imagesy( $img )";
        exit;
这两种方法都不行,没有输出任何数据。图片路径是对的,可以打开图片
------解决思路----------------------
第一种方法是可以的,怀疑你路径有问题。
list( $width ,  $height ,  $type ,  $attr ) = getimagesize('http://avatar.csdn.net/1/9/2/1_mengfk000.jpg');
print_r($width);echo "
";
print_r($height);echo "
";
print_r($attr);echo "
";
------解决思路----------------------
打开php的错误提示功能。

如果图片能打开,至少第二种是有输出的。第一个是因为 getimagesize(' http://192.168.254.20/Public/images/0.jpg'); 路径前面有空格。
------解决思路----------------------

print_r(getimagesize('http://avatar.csdn.net/1/9/2/1_mengfk000.jpg'));
Copy after login
Array
(
    [0] => 150
    [1] => 150
    [2] => 2
    [3] => width="150" height="150"
    [bits] => 8
    [channels] => 3
    [mime] => image/jpeg
)

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!