0

Can you please let me know how I can Strikethrough a generated text on captcha image in PHP? I have a code to create text on an image as below

<?php
$img          = imagecreatetruecolor(200, 200);
$bgColor      = imagecolorallocate($img, 255, 255, 255);
$netColor     = imagecolorallocate($img, 185, 185, 185);
$txtColor     = imagecolorallocate($img, 0, 0, 0);
imagefill($img, 0, 0, $bgColor);
imagettftext($img, 22, 0, 50 ,45, $txtColor,"Bedizen.ttf","Expert" );   
header("Content-type:image/png");
imagepng($img);
imagedestroy($img);
?>

and I would like to make the text like Strikethrough. i know one way is adding a line on the image but just wondering if we can add style to the text in PHP or not?
Thanks for your time and comments.

4
Contributors
4
Replies
29
Views
4 Years
Discussion Span
Last Post by diafol
-2

and I would like to make the text like Strikethrough. i know one way is adding a line on the image but just wondering if we can add style to the text in PHP or not?

You can do that on html but for captcha image. The asnwer is NO. It's an image.

These are php captcha:

http://www.phpcaptcha.org/try-securimage/

If you need a Strikethrough on the image then it has to be an image that you created a line for the background.

This is more like a design thing rather than a PHP issue.

Edited by LastMitch: grammer

0

Maybe I ask what is the code to Strikethrough? Since I got downvote that means someone has an answer to that??

Care to share? If I find out did that I will downvote you too.

Edited by LastMitch: grammer

0

If I find out did that I will downvote you too.

You do? Didn't think you would, after experiencing the effects.

Anyway, what may be the cause, is that the question is about a strikethrough option for imagettftext. I haven't seen it done yet (nor any other styles), so I think drawing the line yourself is the only option.

0

Having looked at gd functions recently, I can't remember seeing anything for strikethrough. I doubt whetehr imagemagick has either. This will be quite fiddly I think.

Since I got downvote that means someone has an answer to that?? ... If I find out did that I will downvote you too.

Let it go. Life's too short. Probably a fly-byer anyway.

Edited by diafol

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.