3raser Posted February 26, 2010 Share Posted February 26, 2010 Here is my code: <?php $image = ImageCreateFromPNG("image.png"); $color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $colorShadow = imagecolorallocate($image, 0x66, 0x66, 0x66); $font = 'arial'; $fontSize = "11"; $fontRotation = "0"; $message = $_POST['message']; $str = $message; /* Shadow */ ImageTTFText($image, $fontSize, $fontRotation, 7, 22, $colorShadow, $font, $str); /* Top Level */ ImageTTFText($image, $fontSize, $fontRotation, 5, 20, $color, $font, $str); header("Content-Type: image/PNG"); imagepng ($image); imagedestroy($image); ?> When you visit http://srl.comoj.com/submit.php (after you've typed in your message), it doesn't display the image.....it just gives me the image icon error or whatever you call it. The image you get when a image isn't working or it's invalid. Link to comment https://forums.phpfreaks.com/topic/193415-image-not-showing-up/ Share on other sites More sharing options...
Andy-H Posted February 26, 2010 Share Posted February 26, 2010 This is because you have to use the HTML img tag with the src attribute as the file that created (and, in this case; destroyed) the image. I.e <img src="http://srl.comoj.com/submit.php" > In the file in which you wish the image to be displayed. Link to comment https://forums.phpfreaks.com/topic/193415-image-not-showing-up/#findComment-1018310 Share on other sites More sharing options...
Andy-H Posted February 26, 2010 Share Posted February 26, 2010 You will also need to use get data, then you create a page with <img src="http://srl.comoj.com/submit.php?message=Get message here!" > <?php $image = ImageCreateFromPNG("image.png"); $color = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $colorShadow = imagecolorallocate($image, 0x66, 0x66, 0x66); $font = 'arial'; $fontSize = "11"; $fontRotation = "0"; $str = isset($_GET['message']) ? $_GET['message'] : 'Default here.'; /* Shadow */ ImageTTFText($image, $fontSize, $fontRotation, 7, 22, $colorShadow, $font, $str); /* Top Level */ ImageTTFText($image, $fontSize, $fontRotation, 5, 20, $color, $font, $str); header("Content-Type: image/PNG"); imagepng ($image); imagedestroy($image); ?> Link to comment https://forums.phpfreaks.com/topic/193415-image-not-showing-up/#findComment-1018312 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.