i cant get an answer

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jtc970

    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="000000 000";
    $sizet="20";
    $fontt="arial.t tf";
    $rightt="200";
    $downt="50";
    $rotatet="0";
    $addliner='1 random 1
    2 random 2
    3 random 3
    4 random 4';
    $colorr="000000 000";
    $sizer="20";
    $fontr="BNKGOTH L.TTF";
    $rightr="20";
    $downr="50";
    $rotater="0";
    $back1="frame_o range.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 = imagecreatefrom png('backs/'.$back1);

    $colorrr = substr($colorr, 0,3);
    $colorrg = substr($colorr, 3,3);
    $colorrb = substr($colorr,-3,3);
    $colorr = ImageColorAlloc ate($image,$col orrr,$colorrg,$ colorrb);

    $colortr = substr($colort, 0,3);
    $colortg = substr($colort, 3,3);
    $colortb = substr($colort,-3,3);
    $colort = ImageColorAlloc ate($image,$col ortr,$colortg,$ colortb);

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

    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....

  • CountScubula

    #2
    Re: i cant get an answer

    "jtc970" <me@hme.com> wrote in message
    news:MPG.1a8662 a2f204e2c498968 3@netnews.comca st.net...[color=blue]
    > 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)[/color]

    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


    Comment

    • jtc970

      #3
      Re: i cant get an answer

      In article <B_0Tb.8508$5Y4 .7771@newssvr29 .news.prodigy.c om>,
      me@scantek.hotm ail.com says...[color=blue]
      > "jtc970" <me@hme.com> wrote in message
      > news:MPG.1a8662 a2f204e2c498968 3@netnews.comca st.net...[color=green]
      > > 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)[/color]
      >
      > 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
      >
      >
      >[/color]
      the time changes in all browsers but the random line only changes in IE
      not Mozilla or Opera.

      Comment

      • jn

        #4
        Re: i cant get an answer


        "jtc970" <me@hme.com> wrote in message
        news:MPG.1a8668 296d59b5c898968 4@netnews.comca st.net...[color=blue]
        > In article <B_0Tb.8508$5Y4 .7771@newssvr29 .news.prodigy.c om>,
        > me@scantek.hotm ail.com says...[color=green]
        > > "jtc970" <me@hme.com> wrote in message
        > > news:MPG.1a8662 a2f204e2c498968 3@netnews.comca st.net...[color=darkred]
        > > > I have come across the strangest thing..I hope someone in here can[/color][/color][/color]
        help[color=blue][color=green][color=darkred]
        > > > me understand whats up.
        > > >
        > > > i have a php image http://sigs.hopto.org/sigs/mysig/sig51.php
        > > > which looks like this
        > > >
        > > > (snip)[/color]
        > >
        > > 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[/color][/color]
        for[color=blue][color=green]
        > > quit a long time. (IE 6.026)
        > >
        > >
        > >
        > >
        > > --
        > > Mike Bradley
        > > http://www.gzentools.com -- free online php tools
        > >
        > >
        > >[/color]
        > the time changes in all browsers but the random line only changes in IE
        > not Mozilla or Opera.
        >[/color]

        Maybe send a header that tells it not to cache the image?


        Comment

        • Jeffrey Silverman

          #5
          Re: i cant get an answer

          On Sun, 01 Feb 2004 11:40:22 +0000, jn wrote:
          [color=blue]
          > Maybe send a header that tells it not to cache the image?[/color]

          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|
          -------------------------

          Comment

          • Jeffrey Silverman

            #6
            Re: i cant get an answer

            On Sun, 01 Feb 2004 06:11:52 +0000, jtc970 wrote:
            [color=blue]
            > 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="000000 000";
            > $sizet="20";
            > $fontt="arial.t tf";
            > $rightt="200";
            > $downt="50";
            > $rotatet="0";
            > $addliner='1 random 1
            > 2 random 2
            > 3 random 3
            > 4 random 4';
            > $colorr="000000 000";
            > $sizer="20";
            > $fontr="BNKGOTH L.TTF";
            > $rightr="20";
            > $downr="50";
            > $rotater="0";
            > $back1="frame_o range.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 = imagecreatefrom png('backs/'.$back1);
            >
            > $colorrr = substr($colorr, 0,3);
            > $colorrg = substr($colorr, 3,3);
            > $colorrb = substr($colorr,-3,3);
            > $colorr = ImageColorAlloc ate($image,$col orrr,$colorrg,$ colorrb);
            >
            > $colortr = substr($colort, 0,3);
            > $colortg = substr($colort, 3,3);
            > $colortb = substr($colort,-3,3);
            > $colort = ImageColorAlloc ate($image,$col ortr,$colortg,$ colortb);
            >
            > ImageTTFText ($image,$sizer, $rotater, $rightr, $downr,$colorr,
            > 'fonts/'.$fontr,$addli ner);
            > ImageTTFText ($image,$sizet, $rotatet, $rightt, $downt,
            > $colort,'fonts/'.$fontt,$time) ;
            > Imagepng($image );
            > ImageDestroy($i mage);
            > ?>
            >
            > 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....[/color]

            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($line r);

            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|
            -------------------------

            Comment

            • jtc970

              #7
              Re: i cant get an answer

              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..

              Comment

              • jtc970

                #8
                Re: i cant get an answer

                In article <MPG.1a86e944f7 902aae989685@ne tnews.comcast.n et>, me@hme.com
                says...[color=blue]
                > 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..
                >[/color]
                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,somewha t, I still want to know WTF?!

                Comment

                • Jeffrey Silverman

                  #9
                  Re: i cant get an answer

                  On Sun, 01 Feb 2004 16:12:28 +0000, jtc970 wrote:
                  [color=blue]
                  > In article <MPG.1a86e944f7 902aae989685@ne tnews.comcast.n et>, me@hme.com
                  > says...[color=green]
                  >> 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..
                  >>[/color]
                  > 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,somewha t, I still want to know WTF?![/color]

                  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|
                  -------------------------

                  Comment

                  • jtc970

                    #10
                    Re: i cant get an answer

                    In article <pan.2004.02.01 .16.37.41.20984 1@jhu.edu>, jeffrey@jhu.edu
                    says...[color=blue]
                    > On Sun, 01 Feb 2004 16:12:28 +0000, jtc970 wrote:
                    >[color=green]
                    > > In article <MPG.1a86e944f7 902aae989685@ne tnews.comcast.n et>, me@hme.com
                    > > says...[color=darkred]
                    > >> 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..
                    > >>[/color]
                    > > 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,somewha t, I still want to know WTF?![/color]
                    >
                    > 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...
                    >[/color]
                    anyone who can figure this out?

                    Comment

                    • Dan Tripp

                      #11
                      Re: i cant get an answer

                      jtc970 wrote:
                      [color=blue]
                      > In article <pan.2004.02.01 .16.37.41.20984 1@jhu.edu>, jeffrey@jhu.edu
                      > says...
                      >[color=green]
                      >>On Sun, 01 Feb 2004 16:12:28 +0000, jtc970 wrote:
                      >>
                      >>[color=darkred]
                      >>>In article <MPG.1a86e944f7 902aae989685@ne tnews.comcast.n et>, 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_s eed());
                      >>>
                      >>>and it works better but still not good except in IE all is fine...
                      >>>now that its working,somewha t, I still want to know WTF?![/color]
                      >>
                      >>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...
                      >>[/color]
                      >
                      > anyone who can figure this out?[/color]


                      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

                      Comment

                      • Dan Tripp

                        #12
                        Re: i cant get an answer

                        jtc970 wrote:
                        [color=blue]
                        > 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
                        >[/color]
                        /snip
                        [color=blue]
                        > $fontr="BNKGOTH L.TTF";[/color]

                        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

                        Comment

                        • jtc970

                          #13
                          Re: i cant get an answer

                          In article <l%iTb.20612$ys 3.15522@newssvr 25.news.prodigy .com>,
                          thisIsNot@MyEMa ilAddress.com says...[color=blue]
                          > jtc970 wrote:
                          >[color=green]
                          > > 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
                          > >[/color]
                          > /snip
                          >[color=green]
                          > > $fontr="BNKGOTH L.TTF";[/color]
                          >
                          > 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/[/color]
                          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.

                          Comment

                          Working...