Quantcast
Channel: WampServer - WampServer English
Viewing all articles
Browse latest Browse all 3177

Gd library not working (no replies)

$
0
0
am new to PHP and was following a lil dated tutorial on youtube

where it converts a text to an image with GD library

but after following the code.. unfortunately, all I get is a small black box on a grey background

here is my code


<?php
header("Content-type: image/jpeg");

$email ="example@example.com";
$email_length =strlen($email);

$font_size =4;

$image_height = ImageFontHeight($font_size);
$image_width = ImageFontWidth($font_size) * $email_length;

$image = imagecreate($image_width,$image_height);

imagecolorallocate($image,255,255,255);

$font_color = imagecolorallocate($image,0,0,0);

imagestring($image,$font_size,0,0,$email,$font_color);
imagejpeg($image);

?>

i am using wampserver and have checked php.ini settings ..it says gd library is enabled

extension=gd2

Viewing all articles
Browse latest Browse all 3177

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>