Server : Apache System : Linux profile 3.10.0-1160.88.1.el7.x86_64 #1 SMP Tue Mar 7 15:41:52 UTC 2023 x86_64 User : apache ( 48) PHP Version : 8.0.28 Disable Function : NONE Directory : /var/www/html/mmishra/mm/ |
<?php
// Set the content-type
header('Content-type: image/jpeg');
$title = $_REQUEST["title"];
//$img = "www.uprtou.ac.in/gallery/bird1.jpg";//$_REQUEST["img"];
$img = $_REQUEST["image"];
// Create the image
$fonts = array('HTOWERT.TTF','MTCORSVA.TTF','BAUHS93.TTF','georgia.TTF');
$no = rand(0,3);
$font = $fonts[$no];
$i = imageloadfont($font);
$im = imagecreatefromjpeg($img);
/* See if it failed */
if(!$im) {
/* Create a black image */
$im = imagecreatetruecolor(450, 30);
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 450, 30, $bgc);
/* Output an error message */
imagestring($im, 1, 5, 5, 'Error loading ' . $img, $tc);
} else {
$tc = imagecolorallocate($im, 0, 0, 0);
// Add the text
imagettftext($im, 24, 10, 50, 130, $tc, $font, $title);
// Using imagepng() results in clearer text compared with imagejpeg()
//imagepng($im);
imagejpeg($im);
}
imagedestroy($im);
?>