Snippets - GD

Snippets index page

Display image without saving - Anthony 14/6/2008

This code adds some text to an image and displays it in the browser without saving it.

  1. <?php
  2. $image imagecreatefromjpeg'image.jpg' );
  3. imagettftext$image9016172, -1'Arial.ttf''Some text' );
  4. imagettftext$image90161105, -1'Arial.ttf''Some more text' );
  5. header"Content-Type: image/png" );
  6. imagepng$image );
  7. imagedestroy$image );
  8. ?>  

For more examples and information check out the main Imagemagick section.

Change a png to a jpg View

Create some text as an image View

Crop an image View

Display image without saving View

Grayscale image View

Resize an image View

Rotate an image View

Watermark an image View