unicorn פורסם 2015 במרץ 30 Share פורסם 2015 במרץ 30 בקוד קיים כאשר אני מכניס את הנתונים ידנית זה עובד אבל כשאני מכניס דרך משתנים אם מתעלם ושם לי ערכים אחרים שאני לא יודע מאיפה הוא שולף אותםלמישהו יש מושג למה?נ.ב. ניסיתי להדביק את הקוד כ-PHP אבל הוא הפך לי הכל לשורה אחת..$font = dirname(__FILE__)."\\monofont.ttf"; $code = generateCode($characters); /* font size will be 75% of the image height */ $font_size = $height * 0.75; $image = @imagecreate($width, $height) or die('Cannot initialize new GD image stream'); /* set the colours */ $background_color = imagecolorallocate($image, 255, 255, 255); $noise_color = imagecolorallocate($image, 191, 157, 94); $text_color = imagecolorallocate($image, 93, 93, 93); /* generate random dots in background */ for( $i=0; $i<($width*$height)/3; $i++ ) { imagefilledellipse($image, mt_rand(0,$width), mt_rand(0,$height), 1, 1, $noise_color); } /* generate random lines in background */ for( $i=0; $i<($width*$height)/150; $i++ ) { imageline($image, mt_rand(0,$width), mt_rand(0,$height), mt_rand(0,$width), mt_rand(0,$height), $noise_color); } /* create textbox and add text */ $textbox = imagettfbbox($font_size, 0, $font, $code) or die('Error in imagettfbbox function'); $x = ($width - $textbox[4])/2; $y = ($height - $textbox[5])/2; imagettftext($image, $font_size, 0, $x, $y, $text_color, $font , $code) or die('Error in imagettftext function'); /* output captcha image to browser */ //header('Content-Type: image/jpeg'); imagejpeg($image,"media-lib/capcha.jpg"); imagedestroy($image); print "<h1>height: $height</h1>"; return $code; קישור לתוכן שתף באתרים אחרים More sharing options...
Recommended Posts
ארכיון
דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.