PHP picture cropped to get picture size getimagesize

Source: Internet
Author: User

On the Internet under a picture-trimmed plug-in jquery.cropzoom.min.js, the function is very powerful, but also helped me prepare a php dynamic script, do not take much effort on the set. And it's pretty good to run. Crop + rotate picture, one key can be.

At first there was no problem, and then there was an inexplicable error. Detailed description is as follows:

Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Warning: getimagesize (http://localhost/cms/uploadfiles/2010/08/24/133934.jpg) [function.getimagesize]: Failed to open STREAM:A connection attempt failed because the connected party did no properly after A respond of Time, or established connection failed because connected host has failed to respond. In d:/appserv/www/cms/test/test.php on line 3

Fatal error: Maximum execution time seconds exceeded into d:/appserv/www/cms/test/test.php on C5>3

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

See this error, I think is not getimagesize need server configuration What, because at home is OK, I immediately debug:

<?php $size =getimagesize ("http://localhost/cms/uploadfiles/2010/08/24/133934.jpg"); Var_dump ($size);?>

the results show quite normal :

x-powered-by:php/5.2.10 Zendserver

set-cookie:zenddebuggercookie=127.0.0.1%3a10137%3a0| | 084|77742d65|1003; path=/

Content-type:text/html

Array (7) {

[0]=>

Int (800)

[1]=>

Int (533)

[2]=>

Int (2)

[3]=>

String (width=) "height=" "533" "

["Bits"]=>

Int (8)

["Channels"]=>

Int (3)

[MIME]=>

String (Ten) "Image/jpeg"

Then ran the code directly on Apache (the web), and there was the same problem. So it should be related to the server. Later, with the mentality of speculation, the http://localhost/cms/uploadfiles/2010/08/24/133934.jpg changed to the relative address. /.. /uploadfiles/2010/08/24/133934.jpg Hey, that's it. It seems to be the picture when the remote loading, do not know how the getimagesize work, so there is no guessing. But if so, how can PHP directly get the size of a remote photo? Solving.

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.