|
Posted by -Lost on 06/06/07 03:54
Jon Slaughter wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:DqmdnblDqsDAlPvbnZ2dnUVZ_u_inZ2d@comcast.com...
>> Jon Slaughter wrote:
>>> is it possible to do image manipulation with php that isn't low level?
>>>
>>> I basically want to create some captchas manually (given a text string)
>>> but I not sure if its possible to do. I want to ultimately do it in real
>>> time if possible.
>>>
>>> The idea is to turn the text into an image and then apply some image
>>> processing(transformations that make it more random such as adding fuzz
>>> or changing colors, etc..) to make it harder to hack.
>>>
>>> How do websites normally go about creating them? Manually or offline?
>>>
>>> Thanks,
>>> Jon
>> Just google for CAPTCHA and PHP. There are several examples out there
>> already - and all do it real time. It's really not that bad.
>>
> lol... I guess I should have done that first... looks quite easy. Although
> I'm looking to do something original with the captchas that will require
> more cycles... but atleast I have somewhere to start.
With GD:
<?php
header('Content-Type: ' . image_type_to_mime_type(IMAGETYPE_JPEG)) . ';';
header('Content-Disposition: filename="' . $_SERVER['REMOTE_ADDR'] . '";');
$img = imagecreate(275,25);
$bg = imagecolorallocate($img, 102, 102, 153);
$fg = imagecolorallocate($img, 255, 255, 255);
imagefill($img, 0, 0, $bg);
$msg = " Your IP is {$_SERVER['REMOTE_ADDR']}";
imagestring($img, 10, 5, 5, $msg, $fg);
imagejpeg($img);
imagedestroy($img);
?>
Of course you would create a random CAPTCHA or whatever floats your boat.
--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
[Back to original message]
|