छवियों की मोटाई () PHP में एक इनबिल्ट फंक्शन है जिसका उपयोग लाइन ड्राइंग के लिए थिकनेस सेट करने के लिए किया जाता है।
सिंटैक्स
bool imagesetthickness($image, $thickness)
पैरामीटर
छवियों की मोटाई () दो पैरामीटर स्वीकार करता है- $image और $thickness।
-
$छवि - यह पैरामीटर इमेज क्रिएशन फंक्शन जैसे कि इमेजक्रिएटट्रूकलर () द्वारा लौटाया जाता है। इसका उपयोग इमेज का आकार बनाने के लिए किया जाता है।
-
$मोटाई - यह पैरामीटर मोटाई को पिक्सेल में सेट करता है।
रिटर्न वैल्यू
छवियों की मोटाई () सफलता पर सही और असफलता पर गलत लौटाता है।
उदाहरण 1
<?php
// Create an image of a given size
$img = imagecreatetruecolor(700, 300);
$gray = imagecolorallocate($img, 0, 0, 255);
$white = imagecolorallocate($img, 0xff, 0xff, 0xff);
// Set the gray background color
imagefilledrectangle($img, 0, 0, 700, 300, $gray);
// Set the line thickness to 10
imagesetthickness($img, 10);
// Draw the rectangle
imagerectangle($img, 30, 30, 200, 150, $white);
// Output image to the browser
header('Content-Type: image/png');
imagepng($img);
imagedestroy($img);
?> आउटपुट

उदाहरण 2
<?php
// Create an image of given size using imagecreatetruecolor() function
$img = imagecreatetruecolor(700, 300);
$blue = imagecolorallocate($img, 0, 0, 255);
$white = imagecolorallocate($img, 0xff, 0xff, 0xff);
// Set the white background-color
imagefilledrectangle($img, 0, 0, 300, 200, $blue);
// Set the line thickness to 50
imagesetthickness($img, 50);
// Draw the white line
imageline($img, 50, 50, 250, 50, $white);
// Output image to the browser
header('Content-Type: image/png');
imagepng($img);
imagedestroy($img);
?> आउटपुट
