note 59831 added to function.getimagesize

From: Date: Sat, 17 Dec 2005 06:50:08 +0000
Subject: note 59831 added to function.getimagesize
Groups: php.notes 
Request: Send a blank email to php-notes+get-100327@lists.php.net to get a copy of this message
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. ---- Manual Page -- http://www.php.net/manual/en/function.getimagesize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59831 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59831&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59831&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59831&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59831&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59831&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59831&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59831&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59831&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100327) next »