$text_color2 = imagecolorallocatealpha($image, $text_colorr, $text_colorg, $text_colorb, 127); $randomvalue = randomname(1); $randomposition = mt_rand(-5, 5); imagettftext($image, $font_size, $angle, $x + $randomposition, $y + $randomposition, $text_color2, $font, $randomvalue); } //Waving the image $x = 0; $y = 0; $period = 10; wave_image($image, $x, $y, $image_width, $image_height, $amplitude); // Create the image and save it to a temporary file imagejpeg($image, $name); // Create a new image from the created one using this time ImageMagick function $image = new imagick($name); $image->setImageFormat('png'); $image->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); // Perspective points $points = array(0, 0, 0, 0, 0, 90, 0, 90, 90, 0, 90, 0, 90, 90, 90, 65); // Distorte the image $image->distortImage(Imagick::DISTORTION_PERSPECTIVE, $points, TRUE); // Print the new image echo $image; // Delete the last image unlink($name); } else { if ($_GET['lvl'] === "Captcha_with_3D_radius" and !empty($_GET['text'])) { $parts = str_split($text, 15); // If the number of characters is higher than 15, then divide it after each 15 characters counted set_time_limit(0); header('Content-type: image/gif'); require 'Text3D.class.php';