Thumbnail Generator
Do you have a portfolio with alot of images and would like to quickly convert them into a thumbnail containing the proje...
Do you have a portfolio with alot of images and would like to quickly convert them into a thumbnail containing the project title, description, and other usefull information? Thumbnail Generator can help you with that.
<?php
function addTextOnImage($image, $heading, $description){
// Create Image From Existing File
$jpg_image = imagecreatefrompng($image);
$orig_width = imagesx($jpg_image);
$orig_height = imagesy($jpg_image);
// Allocate A Color For The background
$bcolor=imagecolorallocate($jpg_image, 0, 105, 255);
//Create background
imagefilledrectangle($jpg_image, 0, 80, $orig_width, 0, imagecolorallocate($jpg_image, 0, 105, 255));
imagefilledrectangle($jpg_image, 0, 82, $orig_width, 80, imagecolorallocate($jpg_image, 1, 40, 94));
// Set Path to Font File
$font_path = realpath('./Sailec Medium.ttf');
// Allocate A Color For The Text
$color = imagecolorallocate($jpg_image, 255, 255, 255);
// Print Text On Image
imagettftext($jpg_image, 20, 0, 20, 41, $color, $font_path, $heading);
// Print description On Image
imagettftext($jpg_image, 11, 0, 20, 65, $color, $font_path, $description);
imagettftext($jpg_image, 11, 0, 20, $orig_height-10, imagecolorallocate($jpg_image, 0, 0, 0), $font_path, "Developed by Anomoz Softwares");
//Set the Content Type
header('Content-type: image/jpg');
// Send Image to Browser
imagepng($jpg_image);
// Clear Memory
imagedestroy($jpg_image);
}
// addTextOnImage("image.png", "SMS Campaigner", "this is a text and it looks good");
addTextOnImage("https://projects.anomoz.com/project/images/Screenshot%202022-09-18%20at%2012-57-42%20Investment%20Crm%20Dashboard.png", "SMS Campaigner", "this is a text and it looks good");
?>