473,770 Members | 2,171 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getima gesize]: 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($d ir . $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 2689
ne*****@gmail.c om 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.getima gesize]: 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($d ir . $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.c om 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.getima gesize]: Read error! in
output_fns.p hp 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($d ir . $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
108841
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 work fine, but with error reporting at all they are marked as errors. Why? What am I doing wrong? www.monkeyclaus.org
2
25825
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 line 5 1) reset($kolom1); 2) while(list($cat,$lnk) = each($kolom1)){ 3) kop($cat);
1
4584
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: Undefined offset: 24 in c:\inetpub\wwwroot\classes\file.php on line 348"
3
1671
by: pareshgoel | last post by:
class B { virtual ~B(); } class D:public B { virtual ~D(); }
3
3295
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 (mysqli_num_rows($QueryResult) > 0) { $Row = mysqli_fetch_row($QueryResult); $First = stripslashes($Row); $Last = stripslashes($Row); $Phone = stripslashes($Row); $Address = stripslashes($Row); $City = stripslashes($Row); $State = stripslashes($Row);
6
4480
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 advance. Error: Undefined offset: 0 in /es/ePrintsStats/includes/inc.html.cumulative_usage.es.php on line 16 The code: <?php $current_year = date("Y"); $last_year = date("Y")-1;
7
7043
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 case basis"? \\\ For example, suppose sometimes I receive the value '\x03hi' + \x04bye' for the struct:
9
32504
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 try to not use a code and leave it empty the following php errors happens. I dont understand why. Help me. Error shown are: - PHP Notice: in file /index.php on line 132: Undefined offset: 4 PHP Notice: in file /index.php on line 141:...
8
3998
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' ='~^.~' ); // make sure there is always a match
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10260
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.