Re: imagecreate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8 Feb 2006, at 14:20, Ross wrote:

I am trying to replace the images in a page with this code

 <?
          $im = imagecreatetruecolor(400, 30);
          $ross = imagecolorallocate($im, 203, 116, 0);
     $font = 'simran__.ttf';

           $text = 'chicken pakora';
           imagettftext($im, 20, 0, 10, 20, $ross, $font, $text);
             imagepng($im);
               imagedestroy($im);
               ?>


This is fine here...
http://www.ecurry.net/example1.php
http://www.ecurry.net/example2.php

but when I try and embed in inside a html page I get a garbled mess

http://www.ecurry.net/menu6.php
http://www.ecurry.net/menu6.phps


I know this has something to so with the header but cannnot work it out!

I tried

header("Content-type: image/png");

before the output but I get a garbled mess and the header error.

You need to output the png content type header before the call to imagepng().

If you get a garbled mess the chances are that your script is not 'clean'. In other words, you have output some data elsewhere in your script. This could be something as simple (and invisible) as a carriage-return after your closing PHP tag.

Cheers,

Rich
--
http://www.corephp.co.uk
Zend Certified Engineer
PHP Development Services

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux