On May 13, 1:22 pm, Sailfish
<NIXCAPSsailf...@NIXCAPSunforgettable.com> wrote:
> My bloviated meandering follows what Greg White graced us with on
> 5/13/2013 9:58 AM:
>
>
>
>
>
>
>
> > I am trying to add a gradient to my website. The gradient works like it should in IE9 but in firefox 20 I get repeating gradient bars likehttp://
www.css3files.com/wp-content/themes/css3files_v2/img/examp/rep...
> Netscape/Mozilla Tips:
http://www.ufaq.org/,http://ilias.ca/
Although I have not tested this on a page on my server, it is likely
that the code you give will work.
My comments concern what I consider a much better way for creation of
images than that used. Notice that you have to use exceptions for
several different browsers, and who knows what future browser upgrades
will bring. It was easy to create images with color gradients using
JavaScript many years ago. The down side was that some people turned
script off and that new updates for browsers sometimes would cause
certain scripts to fail to create an image. A better method is to use
php which has long had an extension for image creation which is well
understood. The advantage is that all of the php script is done on the
server and a viewer of the page will not have problems on different
browsers. In fact the viewer can not even see the php script or modify
it. To illustrate, see my page at
http://www.cwdjr.net/video7/RoscoeGreetings.php
. The image for the selection buttons at the top of the page has a
color gradient . In addition it has several red lines, and text is
generated to label the buttons. The php code code to create the image
(less start and end php tags) is below.
$image_height = 30;
$image_width = 315;
$image = imagecreate($image_width, $image_height);
$back_color = imagecolorallocate ($image, 200, 200, 200);
$w = 315; // width of rectangle
$h = 30; // height of rectangle
$x1 =0; // upper left corner rectangle
$x2 = w; //width of rectangle
$y1 = 0; ; // start y of rectangle
$y2 = h; // end y of rectangle
$ym = round($h/2); // mid y of rectangle
$con = 3.141592654/$h ;
for ($i=0;$i<$h;$i++) {
$y=$i;
$ys = $y - $ym;
$rd = round(255*( cos($ys*$con))) ; $bl= 0 ; $gn = round(200*( cos($ys*
$con))) ;
$linecolor = imagecolorallocate ($image, $rd, $gn, $bl);
imageline ($image, $x1, $i, $w, $i,$linecolor);
}
$font_number = 5;
$text_color = imagecolorallocate ($image, 0, 0, 0);
$text ='STOP HTM5 SWF QT WMP REAL SMIL';
imagestring($image, $font_number, 6, $h/2 -$font_number-2, $text,
$text_color);
imagesetthickness ($image,6);
$end_color = imagecolorallocate ($image, 255, 0, 0) ;
imageline ($image, 0, 0, 0, $h,$end_color);
imageline ($image, 45, 0, 45, $h,$end_color);
imageline ($image, 90, 0, 90, $h,$end_color);
imageline ($image, 135, 0, 135, $h,$end_color);
imageline ($image, 180, 0, 180, $h,$end_color);
imageline ($image, 225, 0, 225, $h,$end_color);
imageline ($image, 270, 0, 270, $h,$end_color);
imageline ($image, 315, 0, 315, $h,$end_color);
imageline ($image, 0, 0, $w, 0,$end_color);
imageline ($image, 0, $h, $w, $h,$end_color);
imagecolortransparent($image, $back_color);
header ('Content-Type: image/png');
imagepng ($image);
imagedestroy ($image);
If you only wanted a color gradient, the code would be much shorter.