Reply to Re: php, GD library, Content-type

Your name:

Reply:


Posted by gosha bine on 08/06/07 13:44

On 06.08.2007 14:56 gerrymcc@indigo.ie wrote:
> Hello,
> I've managed to get as far as using some of the GD2 drawing functions
> included in the php_gd2.dll. I can't figure out how to put HTML and
> PHP output on the same browser page, no doubt this has something to
> do with the header; any help would be greatly appreciated.
> Thank you,
> Gerard
>

hi there

just a few lines:


> <?php

if(key($_GET) == 'img') {

> header ("Content-type: image/png");
>
> $t = imagecreate(400,150); // create a blank canvas
> $c = imagecolorallocate($t,0,255,0); // set color for the first
> thing
> imagefilledrectangle($t,10,10,50,50,$c); // draw a rectange
> $c = imagecolorallocate($t,215,20,20); // set color for the next
> imagefilledellipse($t,50,50,75,75,$c); // draw an ellipse
> $w = "it's not easy to learn this stuff!";
> $c = imagecolorallocate($t,50,50,150);
> imagestring($t,4,100,70,$w,$c);
> imagepng($t); // output the image
> imagedestroy($t); // clear memory, but not the browser
>

die(); }

> /* NOTHING FOLLOWING OUTPUTS */
>
> echo "<pre>";
> var_dump(gd_info());
> echo "</pre>";
>

echo "<img src={$_SERVER['PHP_SELF']}?img>";

> ?>

hope this helps.

PS Looks like you need a better understanding on how http and browsers
work, do some reading on this.



--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация