Get QString data from the QPixmap
-
Do you mean you want to extract the text the user has input stored in the gif ?
-
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
-
QImage::bits
gives you the starting address of the raw image data.Where do you get that gif from ?
-
QImage::bits
gives you the starting address of the raw image data.Where do you get that gif from ?
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:
QtCaptchaAlso I can port
PHP
captcha generation to theC++
but it will take long. -
What are you using to generate that captcha ?
-
-
So basically, you want to decipher the captcha image you generate client side to check whether the use input is correct ?
-
So basically, you want to decipher the captcha image you generate client side to check whether the use input is correct ?
Yes.
-
You do realise that the goal of the captcha is to make it really difficult for computer to deduce what's on it ?
-
You do realise that the goal of the captcha is to make it really difficult for computer to deduce what's on it ?
Yes, I know it. I think I have the idea how to decipher it. I will try it and reply.
-
You do realise that the goal of the captcha is to make it really difficult for computer to deduce what's on it ?
So my solution is:
I have stored
$_SESSION["image"]
value to the txt file witch is thecaptcha
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. -
By the way, why do it on the client side ?