$QR=imagecreatefromstring(file_get_contents(
"https://chart.googleapis.com/chart?chs=100x100&cht=qr&chl="
.urlencode($row->id)));
imagecopyresampled($img_source, $QR, 475, 40 , 0, 0, 100, 100, 100,100);
$str=imagecreatefrompng("photos/".$row[id].".png");
imagecopy($img_source,$str, 60, 310 , 0, 0, 100, 100);
We created the path by using file name with directory name in above code and then by using imagecopy() the same is added at a location ( x=60, y=310 ) of the source image.
$str=imagecreatefrompng("logo.png");
imagecopy($img_source,$str, 280, 50 , 0, 0, 50, 50);
Above codes are kept inside the for loop used to generate certificates of all students by taking data from MySQL student table.
File Name | Details |
---|---|
config-pdo.php | PDO Database connection details are stored here. |
gd-certificate.php | Php script to Generate the image with data, profile photo and logo for each student. |
gd-template.jpg | The sample template image used to generate the final certificates. |
sql_dump.txt | SQL Dump to create student table with sample data. |
readme.txt | Instructions on how to run the script |
Applications using GD functions in PHP
Basic function and application using GD in PHP