Parameter path in getimagesize

Source: Internet
Author: User
In getimagesize, the parameter path is incorrect. after uploading an image, the new file name is images/xxx.jpg. however, to use this file for both the front and back ends, I will convert it to the root path.
/Guest/images/xxx.jpg so that I can call this image anywhere. However, when using getimagesize to obtain image information during scaling, you can use images/xxx.jpg, but an error is returned when using/guest/images/xxx.jpg.
Warning: getimagesize (/guest/images/xxx.jpg) [function. getimagesize]: failed to open stream: No such file or directory in
Why? I don't want to change the path.


Reply to discussion (solution)

The path is incorrect. why not paste the following in ...?

The path is incorrect. why not paste the following in ...?
In is followed by getimagesize. the number of rows in this function is incorrect,
However, it is correct to use it, that is, an error occurred while using getimagesize.

Images/xxx.jpg physical (file system) path, based on the current directory
/Guest/images/xxx.jpg is the path in the unified resource location (url), based on the website root

The getimagesize must be a physical path.

Images/xxx.jpg physical (file system) path, based on the current directory
/Guest/images/xxx.jpg is the path in the unified resource location (url), based on the website root

The getimagesize must be a physical path.
This is troublesome. Is there any function to convert a uniform path to a physical path?

$ _ SERVER ['document _ root']. '/guest/images/xxx.jpg'

$ _ SERVER ['document _ root']. '/guest/images/xxx.jpg'
I learned another trick. thank you.

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.