You are here: Re: [PHP] White background with imagecreatetruecolor() « PHP « IT news, forums, messages
Re: [PHP] White background with imagecreatetruecolor()

Posted by "Richard Lynch" on 10/23/05 07:21

On Tue, October 18, 2005 2:21 pm, John Nichel wrote:
> I'm diving into the gd functions for the first time, and I'm having a
> problem creating a white background for an image when using
> imagecreatetruecolor(). The manual says that this function will
> create
> a _black_ image, but looking at imagecolorallocate() it says that the
> first call to this function fills the background color, and they have
> examples like this...
>
> $im = imagecreatetruecolor('example.jpg');
> // sets background to red
> $background = imagecolorallocate($im, 255, 0, 0);

> And that creates the image with the right sizes and positions, but the
> background is black. Is there something wrong in my code, or is the
> manual wrong on the imagecolorallocate() function? TIA.

I believe the automatic filling in of the background color may have
been only in GD 1.0 or something...

I'm not sure I ever saw it work.

On the plus side, it's easy to fill in the background:

imagefilledrectangle($image, 0, 0, $width - 1, $height - 1, $background);


--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this 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

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