Certificate not showing in localhost i.e. imagecreatefromjpeg() not working

159 Views Asked by At

I want to create certificates for users on my website but following code isn't working and only showing grey square when loaded on localhost...

<?php
header('content-type:image/jpeg');
$font="BRUSHSCI.TTF";
$image=imagecreatefromjpeg("certificate.jpg");
$color=imagecolorallocate($image,19,21,22);
$name="Name";
imagettftext($image,50,0,365,420,$color,$font,$name);
$date="12th may 2021";
imagettftext($image,20,0,450,595,$color,"AGENCYR.TTF",$date);
imagejpeg($image);
imagedestroy($image);
?>

This output I got when I run above code:
This output I got when I run above code

0

There are 0 best solutions below