note 59831 deleted from function.getimagesize by dmytton
| From: | dmytton@php.net | Date: | Sat, 17 Dec 2005 09:55:38 +0000 |
| Subject: | note 59831 deleted from function.getimagesize by dmytton | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-100333@lists.php.net to get a copy of this message | ||
Note Submitter: quinn at strangecode dot com
----
It could be true! Getimagesize cannot read images in directories that are really symbolic links. In
the following example the directory "images" is a symlink:
lrwxrwxrwx 1 user user 38 Dec 17 00:17 images -> ../otherimages/
...and when trying to load an image:
/home/user/docroot/images/file.jpg
...getimagesize() throws an error:
"Warning: getimagesize(): Read error! in /home/user/docroot/script.php on line 99"
...even though the image exists, as dictated by file_exists() and is_readable():
<?php
if (file_exists($file_path) && is_readable($file_path)) {
$img_size = getimagesize($file_path);
printf('<img src="/images/%s" %s />', basename($file_path),
$img_size[3]);
}
?>
Wassup!
Using PHP 4.3.11 on linux.