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
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