Jump to content

[SOLVED] image display error


dragonqueen

Recommended Posts

Test page: http://tlb.plesk.freepgs.com/siggyscript.html

 

I'm trying to create sort of a siggy generator where the user enters the text to be added to an image then they can save the finished image. Right now when you submit the form it says "the image siggyscript.php cannot be displayed. Why is is using the script as the image? Here's my html page:

<html>
<head>
<title>Sample Siggy Script!</title>
</head>

<body>

<div align="center">
  <p><img src="http://tlb.plesk.freepgs.com/Tag4Marcy.gif" width="113" height="117"></p>
  
<form method="post" action="/siggyscript.php">
    <p>
      <input name="name" type="text" id="name" value="Enter Name" size="14" maxlength="10">
</p>
    <p>
      <input name="submit" type="submit" id="submit" value="Submit">
</p>
  </form>


</div>

</body>
</html>

 

Here's my php:

<html>
<head>
<title>Your tag is ready!</title>
</head>

<body>

  <?php
  
  header('Content-Type: image/gif');
  
  //load the image to be written on
  $im = @imagecreatefromgif("Tag4Marcy.gif");
  
  //checking for image 
   if(!$im) {
  die("Could not load image!");
  }

  // The text to draw
  $text = $_POST['name'];

  $font = 'arial.ttf';
  $black = imagecolorallocate($im, 0, 0, 0);

  // Add the text
  imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
  
  imagegif($im);
  imagedestroy($im);
  ?>

<?php
error_reporting(E_ALL);
?>


</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/152021-solved-image-display-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.