bccsergio
Joined: Tue May 03, 2011 2:46 pm Posts: 4
|
 SVG gradient script in PHP for IE9 with multiple stops
A little script in PHP I wrote to use gradient in IE9 with multiple stops. File attached (compressed in RAR format)
Instructions below and also commented inside PHP file.
Hope it helps anyone...
============================================ SVG gradient script in PHP by bccsergio
USAGE: you can pass the following vars to gradient.php via GET:
x1, x2, y1, y2 (Ex.: x1=0&x2=0&y1=0&y2=100) - This values are OPTIONAL, but if set, MUST be a valid number between 0 and 100. They will change gradient direction.
stop1, stop2, ..., stop5, .. stopN (where N is the last stop - you can use as many stops as you want) stop vars must have 2 arguments, separated by a comma (,) (Ex.: stop1=0,BCD1E0&stop2=49,7DA7C3&stop3=50,4E87AD&stop4=100,4E87AD) first argument is the stop place (%) - This values MUST be a valid number between 0 and 100 WITHOUT the '%' char second argument is the stop color (#) - This value MUST be a valid HEX color WITHOUT the '#' char PS.: AT LEAST 2 STOP VALUES ARE NEEDED TO GENERATE A VALID GRADIENTE
Full examples in a CSS file: .my_span { background: url(gradient.php?x1=0&x2=0&y1=0&y2=100&stop1=0,BCD1E0&stop2=49,7DA7C3&stop3=50,4E87AD&stop4=100,4E87AD); } #my_div { background: url(gradient.php?x1=100&stop1=0,BCD1E0&stop2=49,7DA7C3&stop3=50,4E87AD&stop4=100,4E87AD); } .my_span { background: url(gradient.php?x2=100&y2=0&stop1=0,BCD1E0&stop2=50,4E87AD&stop3=100,4E87AD); } #my_div { background: url(gradient.php?stop1=0,BCD1E0&stop2=100,4E87AD); }
If no vars are passed via GET to gradient.php, default values will be: x1=0 x2=0 y1=0 y2=100 stop1=0,FFFFFF stop2=100,000000
PS.: Any error in vars will set them to default values. ============================================
Attachments:
File comment: SVG gradient script in PHP for IE9 with multiple stops by bccsergio
gradient.rar [1.49 KiB]
Downloaded 3092 times
|