Urgent Saturday Sunday are working overtime to get this question, how to get the length of the uploaded image width

Source: Internet
Author: User
Urgent, online and so on, Saturday Sunday are working overtime to get this problem, how to get the length of the uploaded image width
How to get the length and width of the uploaded image
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
Neither of these methods is working, and no data is output. The picture path is right, you can open the picture
------to solve the idea----------------------
The first method is possible, and you suspect that there is a problem with your path.
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 "
";
------to solve the idea----------------------
Open the error message function of PHP.

If the picture can be opened, at least the second one is output. The first one is because getimagesize ( ' http://192.168.254.20/public/images/0.jpg '); There are spaces in front of the path.
------to solve the idea----------------------
Print_r (getimagesize (' http://avatar.csdn.net/1/9/2/1_mengfk000.jpg '));
Array
(
[0] = 150
[1] = 150
[2] = 2
[3] = width= "height=" 150 "
[Bits] = 8
[Channels] = 3
[MIME] = Image/jpeg
)
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.