Gd library not working
Posted by: sash_007 (---.live.vodafone.in)
Date: December 10, 2019 05:28AM

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"winking smiley;

$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



Edited 1 time(s). Last edit at 12/10/2019 10:05AM by RiggsFolly.

Options: ReplyQuote
Re: Gd library not working
Posted by: Otomatic (Moderator)
Date: December 10, 2019 09:54AM

Hi,

Sorry, but this forum is not intended to teach you how to use PHP, nor to debug your scripts.
You must address yourself to a specialized PHP site or forum.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.