vendredi 17 avril 2015

Create and then directly load an image from a folder inline with HTML

I want to call image from the dump folder after in website


My image.php page looks like this:



<?php
header('Content-type: image/jpeg');
$jpg_image = imagecreatefromjpeg('Desert.jpg');
$white = imagecolorallocate($jpg_image, 73, 41, 236);
$font_path = 'OpenSans-Italic.TTF';
$text = $_GET['name'] ;
imagettftext($jpg_image, 25, 0, 75, 50, $white, $font_path, $text);
$image_url="dump/".rawurlencode(trim($text)).".jpg";
imagejpeg($jpg_image,$image_url);
readfile($image_url);
imagedestroy($jpg_image);
?>


And I have used a Javascript in home page that redirects me to result.php with the image.


My result.php page looks like this:



<html>
<body>
<img src="image.php?name=<?php echo $_GET['name']; ?>" />
</body>
</html>


Now I'm calling the image from image.php and I want to call it from dump folder. Any help?


Aucun commentaire:

Enregistrer un commentaire