Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> PHP

PHP में imagechar() फंक्शन

imagechar() फंक्शन कैरेक्टर को हॉरिजॉन्टली ड्रॉ करता है।

सिंटैक्स

bool imagechar( img, font, x, y, ch, color )

पैरामीटर्स

  • img: imagecreatetruecolor() के साथ इमेज बनाना।

  • font: फॉन्ट साइज़ सेट करें

  • x: x-निर्देशांक

  • y: y-निर्देशांक

  • c: ड्रॉ करने वाला कैरेक्टर।

  • color: imagecolorallocate() के साथ बनाया गया कलर आइडेंटिफायर।

रिटर्न

imagechar() फंक्शन सफलता पर TRUE या विफलता पर FALSE लौटाता है।

उदाहरण

निम्नलिखित एक उदाहरण है:

<?php 
    $img = imagecreate(400, 300); 
    $str = 'Demo'; 
    $bgcolor = imagecolorallocate($img, 30, 80, 70); 
    $textcolor = imagecolorallocate($img, 255, 255, 255); 
    imagechar($img, 80, 100, 90, $str, $textcolor); 
    header('Content-type: image/png'); 
    imagepng($img); 
?>

आउटपुट

निम्नलिखित आउटपुट है:

PHP में imagechar() फंक्शन

उदाहरण

आइए एक और उदाहरण देखें जहां हम ऊपर दिए गए उदाहरण से अलग निर्देशांकों और ऊंचाई/चौड़ाई के साथ कैरेक्टर ड्रॉ कर रहे हैं:

<?php 
    $img = imagecreate(350, 270); 
    $str = 'Example'; 
    $bgcolor = imagecolorallocate($img, 70, 100, 130); 
    $textcolor = imagecolorallocate($img, 200, 195, 210); 
    imagechar($img, 100, 50, 70, $str, $textcolor); 
    header('Content-type: image/png'); 
    imagepng($img); 
?>

आउटपुट

निम्नलिखित आउटपुट है:

PHP में imagechar() फंक्शन

  1. PHP में imagefill() फंक्शन PHP में imagefill() फंक्शन

    PHP में imagefill() फंक्शन छवि में निर्दिष्ट प्रारंभिक बिंदु से फ्लड फिल (flood fill) ऑपरेशन करता है - अर्थात्, यह मिलते-जुलते रंग वाले सभी जुड़े हुए क्षेत्र को निर्दिष्ट रंग से भर देता है। सिंटैक्स (Syntax) imagefill(GdImage $image, int $x, int $y, int $color): bool पैरामीटर्स (Parameters) $ima

  1. PHP में imagefilledrectangle() फंक्शन PHP में imagefilledrectangle() फंक्शन

    PHP में imagefilledrectangle() फंक्शन छवि पर एक भरा हुआ आयत (filled rectangle) खींचता है। यह निर्दिष्ट दो कोनों के बीच के पूरे आयताकार क्षेत्र को रंग से भर देता है। सिंटैक्स (Syntax) imagefilledrectangle(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): bool पैरामीटर्स (Parameters)

  1. PHP में imagefilledellipse() फंक्शन PHP में imagefilledellipse() फंक्शन

    PHP में imagefilledellipse() फंक्शन छवि पर एक भरा हुआ अंडाकार (filled ellipse) खींचता है। केंद्र निर्देशांक, चौड़ाई और ऊंचाई निर्दिष्ट करके अंडाकार बनाया जाता है। सिंटैक्स (Syntax) imagefilledellipse(GdImage $image, int $cx, int $cy, int $width, int $height, int $color): bool पैरामीटर्स (Paramete