Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Very strange behaviour of imageftbbox()?
- The Natural Philosopher
March 16, 2011, 6:04 pm
rate this thread
I have some code, which works 100% solidly on one machine, but
*randomly* fails WITH EXACTLY THE SAME INPUT DATA on another.
That is, when involved with the same data, it works, or sometimes it
What the bit of code does, is center a bit of text in an image. To do
this, it needs to know how wide the text is..so it calls this
and subtracts it from the X value of the text center
imagettftext ( $image ,$fontsize,0,
$dest_x+$cx - textoffset($fontsize,$font,$label),
$tmp=imageftbbox( $size, 0.0,$font,$string);
On one machine with as near as I can judge identical software, albeit on
a 32 bit rather than 64 bit platform, sometimes the text is in the right
place, but sometimes it's displaced well to the right, and sometimes
it's simply not there at all - presumably right off the edge of the
Now I stress that this does not change with the parameters supplied to
the program. The same parameters to the same program will produce
different results depending on some condition I have not established.
Now for a bit more information. The actual php code is used to generate
these images is called by <img> statements in another php program's output.
If a single instance of this code is running, I have not yet made it break.
BUT if I call up several instances - i.e. the web browser calls for
half a dozen instances of the program simultaneously via several
slightly different <img> statements in the same page, that seems to be
when the problem happens.
Is it possible that some part of the GD library is not re-entrant?
That's the only thing I can think of..or do you know better?
- » ssh on command line: force using a group size (prime size) of 1024 (and no...
- — The site's Newest Thread. Posted in » Secure Shell Forum