imgsrc: HTML Image tag, alt src width height attributes
imgsrc: HTML Image tag
imgsrc: HTML Image tag
In PHP there have many predefined function which helps to create background image and write text in the image. Like create CAPTCHA image for website. Program:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <?php header("Content-Type: image/jpeg"); // Set the content type header - in this case image/jpeg $image = imagecreatetruecolor(400,70); $color = imagecolorallocate($image,52,237,214); imagefilledrectangle($image,0,0,400,70,$color); $fontstyle = "4.ttf"; $fontcolor = imagecolorallocate($image,254,7,82); $text = "PHP is Amazing"; imagettftext($image,30,0,80,50,$fontcolor,$fontstyle,$text); imagejpeg($image); imagejpeg($image, "image.jpg"); ?> |
Output Explanation: Firstly if user write any image code in PHP script need to set content-type:image/jpeg. Because by default PHP script content type is text/html. Browser only read … Read more