1

okay, so im using this piece of code:

<?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);

  // Set Path to Font File
  $font_path = 'font.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);
?>

and i have GD installed.

but the results show me this:

enter image description here

any idea why?

Thew
  • 15,789
  • 18
  • 59
  • 100
Malin Pedersen
  • 141
  • 1
  • 1
  • 7
  • 1
    Several functions have return values (e.g., `imagejpeg` returns `FALSE` on error). Start with debugging by looking where the functions fail. – Marcel Korpel Dec 01 '13 at 14:06
  • Please improve your title – Thew Dec 01 '13 at 14:30
  • 1
    In addition to debugging like @MarcelKorpel said, you should remove the header and check if any error messages appear. – Thew Dec 01 '13 at 14:33

0 Answers0