$con=mysqli_connect(‘localhost’,’root’,”,’mylib’);//connect sa database
$query=”select * from reguser” ;//select column
$fire=mysqli_query($con,$query);
while($row=mysqli_fetch_array($fire))
{
header(‘content-type:image/jpeg’);
$font= realpath(‘arial.ttf’);
$image=imagecreatefromjpeg(“format.jpg”);
$color=imagecolorallocate($image, 51, 51, 102);
$date=date(‘d F, Y’);//Current Date
imagettftext($image, 18, 0, 880, 188, $color,$font, $date);
$name=$row[‘username’];
imagettftext($image, 48, 0, 120, 520, $color,$font, $name);
imagejpeg($image,”certificate/$name.jpg”);//Storing certificate here
imagedestroy($image);
}
?>“`