Undefined Offset / Read Error!

Undefined Offset / Read Error!

am 15.04.2008 04:12:14 von 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

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

Re: Undefined Offset / Read Error!

am 15.04.2008 10:04:44 von Erwin Moller

neridaj@gmail.com schreef:
> 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

Hi,

That means that $imgarr[$i] isn't defined.
To debug: add before that line:
echo "

";
print_r($imgarr);
echo "
";
exit;

Re: Undefined Offset / Read Error!

am 15.04.2008 10:05:06 von Erwin Moller

Erwin Moller schreef:
> neridaj@gmail.com schreef:
>> 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
>
> Hi,
>
> That means that $imgarr[$i] isn't defined.
> To debug: add before that line:
> echo "

";
> print_r($imgarr);
> echo "
";
> exit;

I forgot my regards. ;-)

Regards,
Erwin Moller