Bug #74504 [Csd->Nab]: getimagesize fails with relative path
| From: | requinix@php.net | Date: | Thu, 27 Apr 2017 19:38:20 +0000 |
| Subject: | Bug #74504 [Csd->Nab]: getimagesize fails with relative path | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208824@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74504&edit=1
ID: 74504
Updated by: requinix@php.net
Reported by: dpfender44 at gmail dot com
Summary: getimagesize fails with relative path
-Status: Closed
+Status: Not a bug
Type: Bug
Package: GetImageSize related
Operating System: Windows
PHP Version: 7.1.4
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2017-04-27 19:31:18] dpfender44 at gmail dot com
Sorry for the confusion. A function of mine was called to scan for files and it resulted in the
current working directory to be one level above the one where the script was initially started.
Using chdir() to reset the original directory after the scan fixed the problem.
------------------------------------------------------------------------
[2017-04-27 07:18:38] requinix@php.net
Works fine for me. Are you sure the working directory is what you think it is? You know it's
not necessarily the same directory that the current executing script is in, right?
echo getcwd() . "/" . $fpath;
------------------------------------------------------------------------
[2017-04-26 22:03:15] dpfender44 at gmail dot com
Description:
------------
If the path to the image file is relative to current directory (up a level), the file cannot be
found. Only a path from the current level and downward will work or using a full path from the very
top level. There is nothing in the documentation to say that this should not work.
Test script:
---------------
// current working directory is w:/xxx/admin
// images are in w:/xxx/pics
$fpath = '../pics/img.jpg';
$x = getimagesize($fpath);
// CANNOT FIND THE FILE
$fpath = 'w:/xxx/pics/img.jpg';
$x = getimagesize($fpath);
// RESULT is GOOD
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74504&edit=1