note 109098 modified in function.getimagesize by danbrown

From: Date: Tue, 26 Jun 2012 14:04:23 +0000
Subject: note 109098 modified in function.getimagesize by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-188856@lists.php.net to get a copy of this message
If your code fails, you are returned an Warning.

<?php $pictureinfo = getimagesize('baghlbgfldfgdfgdfg.jpg'); ?>

PHP Warning: getimagesize(baghlbgfldfgdfgdfg.jpg): failed to open stream: No such file or directory in index.php on line 89

By var_dump($pictureinfo), you get bool(false).

You can then detect a failed attempt by using:

<?php
if($pictureinfo == false) {
		
}
?> --was-- If your code fails, you are returned an Warning. $pictureinfo = getimagesize('baghlbgfldfgdfgdfg.jpg'); PHP Warning: getimagesize(baghlbgfldfgdfgdfg.jpg): failed to open stream: No such file or directory in index.php on line 89 By var_dump($pictureinfo), you get bool(false). You can then detect a failed attempt by using: if($pictureinfo == false) { } http://php.net/manual/en/function.getimagesize.php

« previous php.notes (#188856) next »