i recently updated xamp just yesterday but the thing is when i use my php script to show image and text over it on online website host then then text on image is
displayed but not in xampp localhost any solutions
i get error on display like
The image “http://wno-host.ddns.net:90/p/” cannot be displayed because it contains errors
the code i use
- Code: Select all
<?php
//Set the Content Type
header('Content-type: image/jpeg');
// Create Image From Existing File
$jpg_image = imagecreatefromjpeg('sunset.jpg');
// Allocate A Color For The Text
$white = imagecolorallocate($jpg_image, 255, 255, 255);
putenv('GDFONTPATH=' . realpath('.'));
$font = 'Arial.ttf';
// Set Text to Be Printed On Image
$text = "This is a sunset!";
// Print Text On Image
imagettftext($jpg_image, 25, 0, 75, 300, $white, $font_path, $text);
// Send Image to Browser
imagejpeg($jpg_image);
// Clear Memory
imagedestroy($jpg_image);
?>
output