neridaj Posted April 15, 2008 Share Posted April 15, 2008 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 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 Link to comment https://forums.phpfreaks.com/topic/101145-undefined-offset-read-error/ Share on other sites More sharing options...
hitman6003 Posted April 15, 2008 Share Posted April 15, 2008 which is line 315? Link to comment https://forums.phpfreaks.com/topic/101145-undefined-offset-read-error/#findComment-517314 Share on other sites More sharing options...
sasa Posted April 15, 2008 Share Posted April 15, 2008 try function get_imgdim() { $dir = get_imgdir(); $files = scandir($dir); $dimarr = array(); 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 . $value); // line 315 list($width, $height) = $size; $dimarr[$value] = array("width" => $width, "height" => $height); //} } } return $dimarr; } Link to comment https://forums.phpfreaks.com/topic/101145-undefined-offset-read-error/#findComment-517379 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.