From addc5a14a93547f630f23e5b6a79cffa2e37d71a Mon Sep 17 00:00:00 2001 From: lolcat Date: Sat, 17 Feb 2024 23:22:19 -0500 Subject: boobs --- captcha.php | 126 +++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 91 insertions(+), 35 deletions(-) (limited to 'captcha.php') diff --git a/captcha.php b/captcha.php index 21da034..a92b0ee 100755 --- a/captcha.php +++ b/captcha.php @@ -1,47 +1,104 @@ newImage(400, 400, $theme["bg"]); +$im->newImage(400, 427, $theme["bg"]); $im->setImageBackgroundColor($theme["bg"]); $im->setImageFormat("jpg"); @@ -76,12 +133,18 @@ for($y=0; $y<4; $y++){ for($x=0; $x<4; $x++){ - $tmp = new Imagick("./data/captcha/" . $grid[0][$i][0] . "/" . random_int(1, $grid[0][$i][1]) . ".png"); + $tmp = new Imagick("./data/captcha/" . $grid[$i][0] . "/" . random_int(1, $grid[$i][1]) . ".png"); // convert transparency correctly $tmp->setImageBackgroundColor("black"); $tmp->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE); - + + // randomly mirror + if(random_int(0,1) === 1){ + + $tmp->flopImage(); + } + // distort $tmp $tmp->distortImage( $distort[random_int(0,1)], @@ -101,21 +164,15 @@ for($y=0; $y<4; $y++){ false ); + $tmp->addNoiseImage($noise[random_int(0, 1)]); + // append image - $im->compositeImage($tmp->getImage(), Imagick::COMPOSITE_DEFAULT, $x * 100, $y * 100); + $im->compositeImage($tmp->getImage(), Imagick::COMPOSITE_DEFAULT, $x * 100, ($y * 100) + 27); $i++; } } -// add noise -$im->addNoiseImage($noise[random_int(0, 1)]); - -// expand top of image -$im->setImageGravity(Imagick::GRAVITY_SOUTH); -$im->chopImage(0, -27, 400, 400); -$im->extentImage(0, 0, 0, -27); - // add text $draw = new ImagickDraw(); $draw->setFontSize(20); @@ -123,7 +180,7 @@ $draw->setFillColor($theme["fg"]); //$draw->setTextAntialias(false); $draw->setFont("./data/captcha/font.ttf"); -$text = "Pick " . $grid[1] . " images of " . str_replace("_", " ", $grid[2]); +$text = "Pick " . $picks . " images of " . str_replace("_", " ", $choosen[0]); $pos = 200 - ($im->queryFontMetrics($draw, $text)["textWidth"] / 2); @@ -143,5 +200,4 @@ for($i=0; $isetFormat("jpeg"); $im->setImageCompressionQuality(90); -$im->setImageCompression(Imagick::COMPRESSION_JPEG2000); echo $im->getImageBlob(); -- cgit v1.2.3