Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undefined offset in GD library

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
0
0
GB
I have an error which I just do not understand, hopefully one of you guys will enlighten me. I have a script which plots lines between points. I am using polygons to make the lines thicker.
Code:
echo "$endx1,$endy1 | $endx2,$endy2 | $endx3,$endy3 | $endx4,$endy4<br><br>";
$poynts = array($endx1,$endy1,$endx2,$endy2,$endx3,$endy3,$endx4,$endy4);
imagefilledpolygon ( $thumb , $poynts,  4 , $hiculler );
Most of the lines are plotted correctly but occasionally the script throws an error. Here is an example of values which caused this mysterious 'Undegfined offset' error.

Code:
312,260 | 311,255 | 374,247 | 375,252

Notice: Undefined offset: 0 in /[URL unfurl="true"]www.xxxxxxxxxxxxx[/URL] on line 168
Line 68 is the call to imagefilledpolygon.

I would have thought this error would occur if two adjacent plot points were the same but all the plot points are different.

Any clue why I am getting this error?

Keith
 
Hi Keith,
I don't see the problem. Can you provide me with enough code so I can try to recreate it?

-----------------------------------------
I cannot be bought. Find leasing information at
 
Are you sure you're on the correct line?
Notice: Undefined offset: 0 in / on line 168

and you say 68 is imagefilledpolygon.

I don't see any problem either...
You did define $thumb and $hiculler?
 
Sorry the line number should have been 168. It is really strange that only certain number combinations cause this error. I am plotting 50 lines and just the odd one causes the problem. It seems to happen when there is a difference of 1 in both x and y coords. There is a calculation before this section so I have made it spread the values a bit. This part is for line drawing only, the calcs are done on single points. I will live with it for now and see if it causes further problems.
Thanks for the assistance

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top