Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get QString data from the QPixmap

Get QString data from the QPixmap

Scheduled Pinned Locked Moved Solved General and Desktop
16 Posts 2 Posters 2.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #5

    Do you mean you want to extract the text the user has input stored in the gif ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    Cobra91151C 1 Reply Last reply
    0
    • SGaistS SGaist

      Do you mean you want to extract the text the user has input stored in the gif ?

      Cobra91151C Offline
      Cobra91151C Offline
      Cobra91151
      wrote on last edited by Cobra91151
      #6

      @SGaist

      No, I want extract it to compare with user input from QLineEdit text function.

      So for example, the captcha code: ABCD.
      User input: ABCD.
      So I can compare it as text or some hash to validate if it matches.

      qDebug() << data.bits(); // it returns 0xa1ff200
      
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #7

        QImage::bits gives you the starting address of the raw image data.

        Where do you get that gif from ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        Cobra91151C 1 Reply Last reply
        0
        • SGaistS SGaist

          QImage::bits gives you the starting address of the raw image data.

          Where do you get that gif from ?

          Cobra91151C Offline
          Cobra91151C Offline
          Cobra91151
          wrote on last edited by Cobra91151
          #8

          @SGaist

          I parse it from my website.

          Here is the some PHP code:

          $_SESSION["image"] = implode('', $cod);  // gets code captcha
          header("Content-type: image/gif"); 		//loads the captcha image
          imagegif($src); 
          imagedestroy($src);
          

          I need this - $_SESSION["image"] = implode('', $cod); to be parsed so I can compare later with user input.
          I use $_SESSION["image"] to validate captcha code on the website. So I need to parse it to the application but since the header content type is the image, I can't access the captcha code.

          Another solution is to use this project from GitHub:
          QtCaptcha

          Also I can port PHP captcha generation to the C++ but it will take long.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #9

            What are you using to generate that captcha ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            Cobra91151C 1 Reply Last reply
            0
            • SGaistS SGaist

              What are you using to generate that captcha ?

              Cobra91151C Offline
              Cobra91151C Offline
              Cobra91151
              wrote on last edited by Cobra91151
              #10

              @SGaist

              I generate it by PHP code.

              Image:
              0_1519938262803_2018-03-01_230403.png

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #11

                So basically, you want to decipher the captcha image you generate client side to check whether the use input is correct ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                Cobra91151C 1 Reply Last reply
                0
                • SGaistS SGaist

                  So basically, you want to decipher the captcha image you generate client side to check whether the use input is correct ?

                  Cobra91151C Offline
                  Cobra91151C Offline
                  Cobra91151
                  wrote on last edited by
                  #12

                  @SGaist

                  Yes.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13

                    You do realise that the goal of the captcha is to make it really difficult for computer to deduce what's on it ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Cobra91151C 2 Replies Last reply
                    1
                    • SGaistS SGaist

                      You do realise that the goal of the captcha is to make it really difficult for computer to deduce what's on it ?

                      Cobra91151C Offline
                      Cobra91151C Offline
                      Cobra91151
                      wrote on last edited by
                      #14

                      @SGaist

                      Yes, I know it. I think I have the idea how to decipher it. I will try it and reply.

                      1 Reply Last reply
                      0
                      • SGaistS SGaist

                        You do realise that the goal of the captcha is to make it really difficult for computer to deduce what's on it ?

                        Cobra91151C Offline
                        Cobra91151C Offline
                        Cobra91151
                        wrote on last edited by
                        #15

                        @SGaist

                        So my solution is:

                        I have stored $_SESSION["image"] value to the txt file witch is the captcha code. Then I read this file and now get the value to compare with the user input. Also I'm thinking about putting it to the database or restrict access to the file.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #16

                          By the way, why do it on the client side ?

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved