Undefined Offset / Read Error!

This is a discussion on Undefined Offset / Read Error! within the PHP Language forums, part of the PHP Programming Forums category; Hello, I'm trying to figure out how to get rid of these errors: Notice: Undefined offset: 1 in output_fns....


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008
neridaj@gmail.com
 
Posts: n/a
Default Undefined Offset / Read Error!

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
Reply With Quote
  #2 (permalink)  
Old 04-15-2008
Erwin Moller
 
Posts: n/a
Default Re: Undefined Offset / Read Error!

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 "<pre>";
print_r($imgarr);
echo "</pre>";
exit;
Reply With Quote
  #3 (permalink)  
Old 04-15-2008
Erwin Moller
 
Posts: n/a
Default Re: Undefined Offset / Read Error!

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 "<pre>";
> print_r($imgarr);
> echo "</pre>";
> exit;


I forgot my regards. ;-)

Regards,
Erwin Moller
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 09:57 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0