עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

imagecreate מתעלם מהפרמטרים - PHP

Featured Replies

פורסם

בקוד קיים כאשר אני מכניס את הנתונים ידנית זה עובד אבל כשאני מכניס דרך משתנים אם מתעלם ושם לי ערכים אחרים שאני לא יודע מאיפה הוא שולף אותם

למישהו יש מושג למה?

נ.ב. ניסיתי להדביק את הקוד כ-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;

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.