Undefined Offset / Read Error!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
neridaj
Forum Commoner
Posts: 40
Joined: Fri Jan 05, 2007 9:55 pm

Undefined Offset / Read Error!

Post by neridaj »

Hello,

I'm trying to figure out how to get rid of these errors:

Notice: Undefined offset: 1 in output_fns.php on line 315

Notice: getimagesize() [function.getimagesize]: Read error! in output_fns.php on line 315

Code: Select all

function get_imgdim()
{
    $dir = get_imgdir();
    $files = scandir($dir);
    foreach($files as $value) {
        // check for image files
        if(valid_image_file($value)) {
            // build image array
            $imgarr[] = $value;
            $dimarr = array();
            $count = count($files);
            for($i = 0; $i < $count; $i++) {
                 $size = getimagesize($dir . $imgarr[$i]); // line 315
                 list($width, $height) = $size;
                 $dimarr[$imgarr[$i]] = array("width" => $width, "height" => $height);
            }       
        }
    }
    return $dimarr;
}
Thanks for any help,

Jason
Post Reply