views:

74

answers:

1

I've made gradient images using PHP GD horizontal and vertical but how can you get images like these.

alt text alt text

These are example images for the Emulate Gradient Fill PHP class

EDIT:

I want to know how to make these from scratch, the website is an example

+1  A: 

From the site documentation:

$image = new gd_gradient_fill($width,$height,$direction,$startcolor,$endcolor,$step)

string $direction The shape or direction of the gradient, which can be any of : vertical, horizontal, ellipse, ellipse2, circle, circle2, rectangle, diamond.

So in the function you set the direction to diamond etc, try out the different ones on your own to see how they display.

EDIT

To make them from scratch, well the easiest way is look at the source code of that script: http://planetozh.com/download/gd-gradient-fill.php from there you should be able to rummage through it and get the proper commands for it. Given it is only 240 lines of code it should be trivial to read through it.

Brad F Jacobs
@premiso See the edit
Mark
@Mark see my edit.
Brad F Jacobs
I'm bad at reading classes but I'll try
Mark
What a great opportunity to learn how to read them better! Of course, the other alternative is just utilize the class. :)
Brad F Jacobs
Yeah but I'm really making my own function library :)
Mark
I get a The image cannot be displayed, because it contains errors. $image = new gd_gradient_fill(200,200,'vertical','#fff','#fcc',0);
abel