Right now I have this (I'm going to add more once it works, but I wanted to keep it simple for testing)
<?php
try {
$dbh = new PDO('mysql:host= info goes here');
foreach($dbh->query('SELECT * from table_name') as $row) {
header('Content-type: image/jpeg');
$jpg_image = imagecreatefromjpeg('cert.jpg');
$white = imagecolorallocate($jpg_image, 255, 255, 255);
$font_path = 'arial.TTF';
$text = $row['fname'];
$font_size = 25;
imagettftext($jpg_image, $font_size, 0, 500, 100, $white, $font_path, $text);
imagejpeg($jpg_image);
imagedestroy($jpg_image);
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
The code works, but it is only taking the first name, I'm wondering if there is a way to make it so that it will make one for each name (line) until it reaches the end of the row. I'm planning on saving one image per name. I'm trying to make something that fills in information on a certificate and saves each one in a folder on the server