473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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
Jun 2 '08 #1
2 2674
ne*****@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;
Jun 2 '08 #2
Erwin Moller schreef:
ne*****@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
Jun 2 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: lawrence | last post by:
I just switched error_reporting to ALL so I could debug my site. I got a huge page full of errors. One of the most common was that in my arrays I'm using undefined offsets and indexes. These still...
2
by: Steven | last post by:
Hi All, I am moving some php code from a Linux machine to a Windows 2000 machine with the code belowe I get the following error : Notice: Undefined offset: 1 in c:\inetpub\wwwroot\test.php on...
1
by: google | last post by:
Hello, I'm having major problems trying to get my head round this problem. I'm trying to generate an error free script, however, I still cannot sort out this loop. I get a "Notice:...
3
by: pareshgoel | last post by:
class B { virtual ~B(); } class D:public B { virtual ~D(); }
3
by: delusion7 | last post by:
I am getting this error "Undefined offset: 9 in C:\Course Technology\1687-5\Chapter.10\UpdateContactInfo.php on line 36" this is the code I am recieving the error on: if...
6
by: nicy12 | last post by:
Hi! my name is Peter. iam working on the php platform. while trying to run and compile a program i get the undefined offset error iam nto much familiar with this error . Please help me . Thanks in...
7
by: p.lavarre | last post by:
How do I vary the byte offset of a field of a ctypes.Structure? How do I "use the dynamic nature of Python, and (re-)define the data type after the required size is already known, on a case by...
9
by: simple12 | last post by:
Hello I have a script which have the facility of entering any code to some part of a webpage. I have some problems with it. When i put some code in the script then their is no error shown. When i...
8
by: Thomas Mlynarczyk | last post by:
Hello, I want to split a given string into tokens which are defined by regexes: // example tokens - a bit more complex in real $tokens = array( 'NUMBER' ='~^\d+~', 'NAME' ='~^+~', 'ANY' ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.