Captcha image Text Size

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

    Captcha image Text Size

    Hi,

    Learning PHP code; playing with various methods of generating captcha
    codes:

    In the code below, how would I change the size of the text displayed in
    the captcha code?
    Is it even possible with this method?
    TIA,
    Twayne

    --------------------------
    <?php

    session_start() ;

    $width = 120;

    $height = 40;

    $length = 5;

    $baseList = '23456789abcdfg hjkmnpqrstvwxyz ABCDEFGHIJKLMNP QRSTUVWXYZ';

    $code = "";

    $counter = 0;

    $image = @imagecreate($w idth, $height) or die('Cannot initialize GD!');

    for( $i=0; $i<10; $i++ ) {

    imageline($imag e,

    mt_rand(0,$widt h), mt_rand(0,$heig ht),

    mt_rand(0,$widt h), mt_rand(0,$heig ht),

    imagecoloralloc ate($image, mt_rand(150,255 ),

    mt_rand(150,255 ),

    mt_rand(150,255 )));

    }

    for( $i=0, $x=0; $i<$length; $i++ ) {

    $actChar = substr($baseLis t, rand(0, strlen($baseLis t)-1), 1);

    $x += 10 + mt_rand(0,10);

    imagechar($imag e, mt_rand(3,5), $x, mt_rand(5,20), $actChar,

    imagecoloralloc ate($image, mt_rand(0,155), mt_rand(0,155),
    mt_rand(0,155)) );

    $code .= strtolower($act Char);

    }


    header('Content-Type: image/jpeg');

    imagejpeg($imag e);

    imagedestroy($i mage);

    $_SESSION['securityCode'] = $code;

    ?>

    \

    ---------------------------------




  • SrSilveira

    #2
    Re: Captcha image Text Size

    this may help you

    Comment

    • Michael Fesser

      #3
      Re: Captcha image Text Size

      ..oO(Twayne)
      >Learning PHP code; playing with various methods of generating captcha
      >codes:
      You should forget it. Graphical CAPTCHAs are a huge accessibility
      problem and many of them are already broken and can be read by bots.
      They are definitely _not_ a solution.

      Micha

      Comment

      • Krustov

        #4
        Re: Captcha image Text Size

        <comp.lang.ph p>
        <Michael Fesser>
        <Tue, 08 Apr 2008 23:44:26 +0200>
        <ijpnv3p4b4b095 cdot49ctjqf0ibm cp76r@4ax.com>
        Learning PHP code; playing with various methods of generating captcha
        codes:
        >
        You should forget it. Graphical CAPTCHAs are a huge accessibility
        problem and many of them are already broken and can be read by bots.
        They are definitely _not_ a solution.
        >
        What do you suggest as a alternative ? .


        --

        Comment

        • Twayne

          #5
          Re: Captcha image Text Size

          this may help youThanks, I have that manual; it's a great reference and that's one way to
          do it, for sure. What I'm really doing is going through a learning
          process with PHP and the GD and using captcha for a subject. I have
          about three different and excellent methods pulled together and I'm
          trying to figure out how to use the best parts of each in one, new
          method. Mostly noodling for the education.

          Appreciate the comeback!
          --
          Regards,

          Twayne

          Open Office isn't just for wimps anymore;
          OOo is a GREAT MS Office replacement
          The official home page of the Apache OpenOffice open source project, home of OpenOffice Writer, Calc, Impress, Draw and Base.




          Comment

          • rf

            #6
            Re: Captcha image Text Size

            "Twayne" <nobody@devnull .spamcop.netwro te in news:%IUKj.4310 $mL2.220
            @trndny03:
            >.oO(Twayne)
            >>
            >>Learning PHP code; playing with various methods of generating captcha
            >>codes:
            >>
            >You should forget it. Graphical CAPTCHAs are a huge accessibility
            >problem and many of them are already broken and can be read by bots.
            >They are definitely _not_ a solution.
            >>
            >Micha
            >
            1. Who said anything about USING captcha codes on a web site? Only
            you, I'm afraid.
            Given that the vast majority of questions in this group relate to using
            PHP to build web pages I would think the onus is on *you* to mention if
            you are doing otherwise.


            --
            Richard
            Killing all threads involving google groups
            The Usenet Improvement Project: http://improve-usenet.org

            Comment

            • Richard

              #7
              Re: Captcha image Text Size


              "rf" <rf@x.invalidwr ote in message
              news:82VKj.7509 $n8.6353@news-server.bigpond. net.au...
              "Twayne" <nobody@devnull .spamcop.netwro te in
              news:%IUKj.4310 $mL2.220
              @trndny03:
              >
              >>.oO(Twayne)
              >>>
              >>>Learning PHP code; playing with various methods of generating
              >>>captcha
              >>>codes:
              >>>
              >>You should forget it. Graphical CAPTCHAs are a huge accessibility
              >>problem and many of them are already broken and can be read by
              >>bots.
              >>They are definitely _not_ a solution.
              >>>
              >>Micha
              >>
              >1. Who said anything about USING captcha codes on a web site?
              >Only
              >you, I'm afraid.
              >
              Given that the vast majority of questions in this group relate to
              using
              PHP to build web pages I would think the onus is on *you* to mention
              if
              you are doing otherwise.
              >
              >
              --
              Richard
              Killing all threads involving google groups
              The Usenet Improvement Project: http://improve-usenet.org
              Ehm.... he DID mention that.
              :-P
              Richard.


              Comment

              • rf

                #8
                Re: Captcha image Text Size

                "Richard" <root@localhost wrote in news:47fc2c3d$0 $30410$dbd4d001
                @news.euronet.n l:
                >
                "rf" <rf@x.invalidwr ote in message
                news:82VKj.7509 $n8.6353@news-server.bigpond. net.au...
                >"Twayne" <nobody@devnull .spamcop.netwro te in
                >news:%IUKj.431 0$mL2.220
                >@trndny03:
                >>
                >>>.oO(Twayne )
                >>>>
                >>>>Learning PHP code; playing with various methods of generating
                >>>>captcha
                >>>>codes:
                >>>>
                >>>You should forget it. Graphical CAPTCHAs are a huge accessibility
                >>>problem and many of them are already broken and can be read by
                >>>bots.
                >>>They are definitely _not_ a solution.
                >>>>
                >>>Micha
                >>>
                >>1. Who said anything about USING captcha codes on a web site?
                >>Only
                >>you, I'm afraid.
                >>
                >Given that the vast majority of questions in this group relate to
                >using
                >PHP to build web pages I would think the onus is on *you* to mention
                >if
                >you are doing otherwise.
                >>
                >>
                >--
                >Richard
                >Killing all threads involving google groups
                >The Usenet Improvement Project: http://improve-usenet.org
                >
                Ehm.... he DID mention that.
                >:-P
                Richard.
                >
                >
                Perhaps you could indicate exactly in the above quoted thread where the
                OP specifically stated that this was *not* for use in a publicly viewable
                web site. In my experience people "learn PHP" by building their first web
                page.

                --
                Richard
                Killing all threads involving google groups
                The Usenet Improvement Project: http://improve-usenet.org

                Comment

                • Piotr

                  #9
                  Re: Captcha image Text Size

                  Krustov wrote:
                  >They are definitely _not_ a solution.
                  >
                  What do you suggest as a alternative ? .
                  Here are some nice suggestions
                  Various approaches have been employed over many years to distinguish human users of web sites from robots. The traditional CAPTCHA approach asking users to identify obscured text in an image remains common, but other approaches have emerged. All interactive approaches require users to perform a task believed to be relatively easy for humans but difficult for robots. Unfortunately the very nature of the interactive task inherently excludes many people with disabilities, resulting in a denial of service to these users. Research findings also indicate that many popular CAPTCHA techniques are no longer particularly effective or secure, further complicating the challenge of providing services secured from robotic intrusion yet accessible to people with disabilities. This document examines a number of approaches that allow systems to test for human users and the extent to which these approaches adequately accommodate people with disabilities, including recent non-interactive and tokenized approaches. We have grouped these approaches by two category classifications: Stand-Alone Approaches that can be deployed on a web host without engaging the services of unrelated third parties and Multi-Party Approaches that engage the services of an unrelated third party.


                  best regards
                  Piotr

                  Comment

                  • Twayne

                    #10
                    Re: Captcha image Text Size

                    "Twayne" <nobody@devnull .spamcop.netwro te in news:%IUKj.4310 $mL2.220
                    @trndny03:
                    >
                    >>.oO(Twayne)
                    >>>
                    >>>Learning PHP code; playing with various methods of generating
                    >>>captcha codes:
                    >>>
                    >>You should forget it. Graphical CAPTCHAs are a huge accessibility
                    >>problem and many of them are already broken and can be read by bots.
                    >>They are definitely _not_ a solution.
                    >>>
                    >>Micha
                    >>
                    >1. Who said anything about USING captcha codes on a web site? Only
                    >you, I'm afraid.
                    >
                    Given that the vast majority of questions in this group relate to
                    using PHP to build web pages I would think the onus is on *you* to
                    mention if you are doing otherwise.

                    lol, I *said* I was playing with it. Whether i plan to use it or not
                    has little to do with anything else. Any thinking person answers a
                    question and THEN if there are some followons, adds them as maybe
                    caveats or ... .
                    Answering questions that aren't asked are signs of ego problems at
                    the other end, IMO. I wrote the post properly for what I wanted to ask
                    about.

                    Twayne




                    Comment

                    • Twayne

                      #11
                      Re: Captcha image Text Size

                      "Richard" <root@localhost wrote in news:47fc2c3d$0 $30410$dbd4d001
                      @news.euronet.n l:
                      >
                      >>
                      >"rf" <rf@x.invalidwr ote in message
                      >news:82VKj.750 9$n8.6353@news-server.bigpond. net.au...
                      >>"Twayne" <nobody@devnull .spamcop.netwro te in
                      >>news:%IUKj.43 10$mL2.220
                      >>@trndny03:
                      >>>
                      >>>>.oO(Twayn e)
                      >>>>>
                      >>>>>Learning PHP code; playing with various methods of generating
                      >>>>>captcha
                      >>>>>codes:
                      >>>>>
                      >>>>You should forget it. Graphical CAPTCHAs are a huge accessibility
                      >>>>problem and many of them are already broken and can be read by
                      >>>>bots.
                      >>>>They are definitely _not_ a solution.
                      >>>>>
                      >>>>Micha
                      >>>>
                      >>>1. Who said anything about USING captcha codes on a web site?
                      >>>Only
                      >>>you, I'm afraid.
                      >>>
                      >>Given that the vast majority of questions in this group relate to
                      >>using
                      >>PHP to build web pages I would think the onus is on *you* to mention
                      >>if
                      >>you are doing otherwise.
                      >>>
                      >>>
                      >>--
                      >>Richard
                      >>Killing all threads involving google groups
                      >>The Usenet Improvement Project: http://improve-usenet.org
                      >>
                      >Ehm.... he DID mention that.
                      >:-P
                      >Richard.
                      >>
                      >>
                      >
                      Perhaps you could indicate exactly in the above quoted thread where
                      the OP specifically stated that this was *not* for use in a publicly
                      viewable web site. In my experience people "learn PHP" by building
                      their first web page.

                      Good grief charley brown; I didn't say it wasn't for use in accessing a
                      nuclear reactor, nor for protecting anything, nor anything about a web
                      site, nor ... ... ... ... ... ... .
                      What you want and what you're going to get from people are two vastly
                      different things. I don't get why my playing with different methods of
                      accomplishing the same things captcha code can would piss you off. You
                      seem to actually be pissed that someone would use captcha code to learns
                      some things if they weren't going to use it for catpcha code on a web
                      site. That's interesting, to say the least.
                      I can just imagine your response if I hadn't mentioned "captcha" and
                      just said I was fiddling with this code and then showed it! There are
                      so many variations on how to create captcha code rectangles that it
                      makes for a great example of different ways todo things. Something I
                      suspect you are failing to recognize is that studying how others do
                      things is a great learning tool. I suppose I'm an "oddball" compared to
                      you since I actually KNOW what code does and if I don't, I try to learn
                      it and if I can't, I'll ask what appears to be a better authority then
                      my manuals etc. to figure it out. A forest is made of many trees; in
                      this case all you see is one forest, I think.

                      Cheers,

                      Twayne


                      Comment

                      • Twayne

                        #12
                        Re: Captcha image Text Size

                        Krustov wrote:
                        >>They are definitely _not_ a solution.
                        >>
                        >What do you suggest as a alternative ? .
                        >
                        Here are some nice suggestions
                        Various approaches have been employed over many years to distinguish human users of web sites from robots. The traditional CAPTCHA approach asking users to identify obscured text in an image remains common, but other approaches have emerged. All interactive approaches require users to perform a task believed to be relatively easy for humans but difficult for robots. Unfortunately the very nature of the interactive task inherently excludes many people with disabilities, resulting in a denial of service to these users. Research findings also indicate that many popular CAPTCHA techniques are no longer particularly effective or secure, further complicating the challenge of providing services secured from robotic intrusion yet accessible to people with disabilities. This document examines a number of approaches that allow systems to test for human users and the extent to which these approaches adequately accommodate people with disabilities, including recent non-interactive and tokenized approaches. We have grouped these approaches by two category classifications: Stand-Alone Approaches that can be deployed on a web host without engaging the services of unrelated third parties and Multi-Party Approaches that engage the services of an unrelated third party.

                        >
                        best regards
                        Piotr

                        Thanks; I had actually found that site already but I appreciate your
                        effort in posting it; many others will see it too and that's good. Lots
                        of good reverences there and also at w3c.

                        --
                        Regards,

                        Twayne

                        Open Office isn't just for wimps anymore;
                        OOo is a GREAT MS Office replacement
                        The official home page of the Apache OpenOffice open source project, home of OpenOffice Writer, Calc, Impress, Draw and Base.



                        Comment

                        Working...