Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.