470,849 Members | 1,135 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

i cant get an answer

I have come across the strangest thing..I hope someone in here can help
me understand whats up.

i have a php image http://sigs.hopto.org/sigs/mysig/sig51.php
which looks like this

<?
$colort="000000000";
$sizet="20";
$fontt="arial.ttf";
$rightt="200";
$downt="50";
$rotatet="0";
$addliner='1 random 1
2 random 2
3 random 3
4 random 4';
$colorr="000000000";
$sizer="20";
$fontr="BNKGOTHL.TTF";
$rightr="20";
$downr="50";
$rotater="0";
$back1="frame_orange.png";
include("../thepic.php");
?>

and the pic.php is

<?
Header( "Content-type: image/png");
$time = strftime("%I:%M", time());

$liner = split("\n", $addliner );
$p = rand(0,(count($liner)-1));
$addliner = $liner[$p];

$image = imagecreatefrompng('backs/'.$back1);

$colorrr = substr($colorr,0,3);
$colorrg = substr($colorr,3,3);
$colorrb = substr($colorr,-3,3);
$colorr = ImageColorAllocate($image,$colorrr,$colorrg,$color rb);

$colortr = substr($colort,0,3);
$colortg = substr($colort,3,3);
$colortb = substr($colort,-3,3);
$colort = ImageColorAllocate($image,$colortr,$colortg,$color tb);

ImageTTFText ($image,$sizer, $rotater, $rightr, $downr,$colorr,
'fonts/'.$fontr,$addliner);
ImageTTFText ($image,$sizet, $rotatet, $rightt, $downt,
$colort,'fonts/'.$fontt,$time);
Imagepng($image);
ImageDestroy($image);
?>

someone please tell me why this image can be viewed fine on ie and work
perfect showing a random line each time you view it

but in Opera or Mozilla the time updates fine (so we know it's
refreshing) but the random line doesnt change much, if at all...)

go to the link above ...it doesnt make sense....

Jul 17 '05 #1
12 1955
"jtc970" <me@hme.com> wrote in message
news:MP************************@netnews.comcast.ne t...
I have come across the strangest thing..I hope someone in here can help
me understand whats up.

i have a php image http://sigs.hopto.org/sigs/mysig/sig51.php
which looks like this

(snip)


so, let me get this straight, it is chaning correct?

hmm, it should not be a browser problem, btw, it was on 1 or 4 for me for
quit a long time. (IE 6.026)


--
Mike Bradley
http://www.gzentools.com -- free online php tools
Jul 17 '05 #2
In article <B_*****************@newssvr29.news.prodigy.com> ,
me@scantek.hotmail.com says...
"jtc970" <me@hme.com> wrote in message
news:MP************************@netnews.comcast.ne t...
I have come across the strangest thing..I hope someone in here can help
me understand whats up.

i have a php image http://sigs.hopto.org/sigs/mysig/sig51.php
which looks like this

(snip)


so, let me get this straight, it is chaning correct?

hmm, it should not be a browser problem, btw, it was on 1 or 4 for me for
quit a long time. (IE 6.026)


--
Mike Bradley
http://www.gzentools.com -- free online php tools

the time changes in all browsers but the random line only changes in IE
not Mozilla or Opera.
Jul 17 '05 #3
jn

"jtc970" <me@hme.com> wrote in message
news:MP************************@netnews.comcast.ne t...
In article <B_*****************@newssvr29.news.prodigy.com> ,
me@scantek.hotmail.com says...
"jtc970" <me@hme.com> wrote in message
news:MP************************@netnews.comcast.ne t...
I have come across the strangest thing..I hope someone in here can help me understand whats up.

i have a php image http://sigs.hopto.org/sigs/mysig/sig51.php
which looks like this

(snip)


so, let me get this straight, it is chaning correct?

hmm, it should not be a browser problem, btw, it was on 1 or 4 for me for quit a long time. (IE 6.026)


--
Mike Bradley
http://www.gzentools.com -- free online php tools

the time changes in all browsers but the random line only changes in IE
not Mozilla or Opera.


Maybe send a header that tells it not to cache the image?
Jul 17 '05 #4
On Sun, 01 Feb 2004 11:40:22 +0000, jn wrote:
Maybe send a header that tells it not to cache the image?


That doesn't make sense if the time is changing. the time changing means
the image is changing means the cached image is being replaced.

It is a weird problem, no doubt.

--
-------------------------
| Jeffrey Silverman |
| jeffrey-AT-jhu-DOT-edu|
-------------------------

Jul 17 '05 #5
On Sun, 01 Feb 2004 06:11:52 +0000, jtc970 wrote:
I have come across the strangest thing..I hope someone in here can help me
understand whats up.

i have a php image http://sigs.hopto.org/sigs/mysig/sig51.php which looks
like this

<?
$colort="000000000";
$sizet="20";
$fontt="arial.ttf";
$rightt="200";
$downt="50";
$rotatet="0";
$addliner='1 random 1
2 random 2
3 random 3
4 random 4';
$colorr="000000000";
$sizer="20";
$fontr="BNKGOTHL.TTF";
$rightr="20";
$downr="50";
$rotater="0";
$back1="frame_orange.png";
include("../thepic.php");
?>

and the pic.php is

<?
Header( "Content-type: image/png");
$time = strftime("%I:%M", time());

$liner = split("\n", $addliner );
$p = rand(0,(count($liner)-1));
$addliner = $liner[$p];

$image = imagecreatefrompng('backs/'.$back1);

$colorrr = substr($colorr,0,3);
$colorrg = substr($colorr,3,3);
$colorrb = substr($colorr,-3,3);
$colorr = ImageColorAllocate($image,$colorrr,$colorrg,$color rb);

$colortr = substr($colort,0,3);
$colortg = substr($colort,3,3);
$colortb = substr($colort,-3,3);
$colort = ImageColorAllocate($image,$colortr,$colortg,$color tb);

ImageTTFText ($image,$sizer, $rotater, $rightr, $downr,$colorr,
'fonts/'.$fontr,$addliner);
ImageTTFText ($image,$sizet, $rotatet, $rightt, $downt,
$colort,'fonts/'.$fontt,$time);
Imagepng($image);
ImageDestroy($image);
?>

someone please tell me why this image can be viewed fine on ie and work
perfect showing a random line each time you view it

but in Opera or Mozilla the time updates fine (so we know it's refreshing)
but the random line doesnt change much, if at all...)

go to the link above ...it doesnt make sense....


I don't really know why the image changes only in IE, but I do have a
couple of coding-clean-up-and-simplifcation suggestions for you.

1) Why not put the "1 random 1" etc. text directly into an array instead
of splitting the string?

2) Be sure to initialize the random number generator!!! (Ooops... I just
checked on that and you don't need to do that unless you are using PHP
version eearlier than 4.2)

Well, that's about it. Putting the items directly in the array is the big
thing here.

Also, there is a PHP function called "shuffle()" which will randomize the
order of the array. You can then pop the first item off like so:

shuffle($liner);
$addliner = array_pop($liner);

Its just a bit cleaner, code-wise. But not necessarily better or faster
than the way you did it.

later...

--
-------------------------
| Jeffrey Silverman |
| jeffrey-AT-jhu-DOT-edu|
-------------------------

Jul 17 '05 #6
the lines originally get entered from a multiline textbox from a form so
I cant just enter them straight in.
I tried to shuffle() but the same thing happens
I hope someone comes and says
you idiot.....this is your prob..
Jul 17 '05 #7
In article <MP************************@netnews.comcast.net> , me@hme.com
says...
the lines originally get entered from a multiline textbox from a form so
I cant just enter them straight in.
I tried to shuffle() but the same thing happens
I hope someone comes and says
you idiot.....this is your prob..

I added (which i shouldnt have to, having the latest php)

function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());

and it works better but still not good
except in IE all is fine...
now that its working,somewhat, I still want to know WTF?!
Jul 17 '05 #8
On Sun, 01 Feb 2004 16:12:28 +0000, jtc970 wrote:
In article <MP************************@netnews.comcast.net> , me@hme.com
says...
the lines originally get entered from a multiline textbox from a form so
I cant just enter them straight in.
I tried to shuffle() but the same thing happens I hope someone comes
and says
you idiot.....this is your prob..

I added (which i shouldnt have to, having the latest php)

function make_seed() {
list($usec, $sec) = explode(' ', microtime()); return (float) $sec +
((float) $usec * 100000);
}
srand(make_seed());

and it works better but still not good except in IE all is fine...
now that its working,somewhat, I still want to know WTF?!


Its funny, but an hour ago or so when I first tried it (I use Mozilla on
Linux) it was not changing except the time.

Now, it changes fine, and apparently randomly, as you wanted it to.

Not sure what the prob;lem was.

later...
--
-------------------------
| Jeffrey Silverman |
| jeffrey-AT-jhu-DOT-edu|
-------------------------

Jul 17 '05 #9
In article <pa****************************@jhu.edu>, je*****@jhu.edu
says...
On Sun, 01 Feb 2004 16:12:28 +0000, jtc970 wrote:
In article <MP************************@netnews.comcast.net> , me@hme.com
says...
the lines originally get entered from a multiline textbox from a form so
I cant just enter them straight in.
I tried to shuffle() but the same thing happens I hope someone comes
and says
you idiot.....this is your prob..

I added (which i shouldnt have to, having the latest php)

function make_seed() {
list($usec, $sec) = explode(' ', microtime()); return (float) $sec +
((float) $usec * 100000);
}
srand(make_seed());

and it works better but still not good except in IE all is fine...
now that its working,somewhat, I still want to know WTF?!


Its funny, but an hour ago or so when I first tried it (I use Mozilla on
Linux) it was not changing except the time.

Now, it changes fine, and apparently randomly, as you wanted it to.

Not sure what the prob;lem was.

later...

anyone who can figure this out?
Jul 17 '05 #10
jtc970 wrote:
In article <pa****************************@jhu.edu>, je*****@jhu.edu
says...
On Sun, 01 Feb 2004 16:12:28 +0000, jtc970 wrote:

In article <MP************************@netnews.comcast.net> , me@hme.com
says...

the lines originally get entered from a multiline textbox from a form so
I cant just enter them straight in.
I tried to shuffle() but the same thing happens I hope someone comes
and says
you idiot.....this is your prob..
I added (which i shouldnt have to, having the latest php)

function make_seed() {
list($usec, $sec) = explode(' ', microtime()); return (float) $sec +
((float) $usec * 100000);
}
srand(make_seed());

and it works better but still not good except in IE all is fine...
now that its working,somewhat, I still want to know WTF?!


Its funny, but an hour ago or so when I first tried it (I use Mozilla on
Linux) it was not changing except the time.

Now, it changes fine, and apparently randomly, as you wanted it to.

Not sure what the prob;lem was.

later...


anyone who can figure this out?

I'm getting "The image "http://sigs.hopto.org/sigs/mysig/sig51.php"
cannot be displayed, because it contains errors." with Mozilla 1.6.

IE 6.0 just doesn't display it.

I'm wondering if you aren't altering the version you have at that URL.
If that's the case, I'd like to point out that it's hard to test a
moving target. =)

- Dan
Jul 17 '05 #11
jtc970 wrote:
I have come across the strangest thing..I hope someone in here can help
me understand whats up.

i have a php image http://sigs.hopto.org/sigs/mysig/sig51.php
which looks like this
/snip
$fontr="BNKGOTHL.TTF";


http://sigs.hopto.org/sigs/mysig/fonts/BNKGOTHL.TTF = 404

The font you have designated for "$fontr" is not in the fonts directory.
If you change $fontr to "arial.ttf", or copy BNKGOTHL.TTF into the
fonts directory it'll work, I betcha.

- Dan
http://blog.dantripp.com/
Jul 17 '05 #12
In article <l%*******************@newssvr25.news.prodigy.com> ,
th*******@MyEMailAddress.com says...
jtc970 wrote:
I have come across the strangest thing..I hope someone in here can help
me understand whats up.

i have a php image http://sigs.hopto.org/sigs/mysig/sig51.php
which looks like this

/snip
$fontr="BNKGOTHL.TTF";


http://sigs.hopto.org/sigs/mysig/fonts/BNKGOTHL.TTF = 404

The font you have designated for "$fontr" is not in the fonts directory.
If you change $fontr to "arial.ttf", or copy BNKGOTHL.TTF into the
fonts directory it'll work, I betcha.

- Dan
http://blog.dantripp.com/

yes, i moved the font...sorry
but the original problem was that the rand line only worked in
IE...while the time worked in all browsers...
I had to srand a seed to get the random to work in mozilla or Opera
I have the latest php which says i dont have to do that. plus why would
it work in IE if I did ....
I'll change it back to the original posted code so u all can see it
working in IE and not anything else.
Jul 17 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Fozya | last post: by
14 posts views Thread by ambar.shome | last post: by
reply views Thread by Tony Lewis | last post: by
12 posts views Thread by Crirus | last post: by
4 posts views Thread by Beemer Biker | last post: by
reply views Thread by VELA | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.