Hello
What's the closest one can get to making an element (i.e. empty div)
appear golden in CSS? Same for silver.
How? Any ideas?
Both gold and silver, even if pure, can vary quite a bit in color if
they have been exposed to the air long enough, so there is no single
color for showing all gold or silver objects. Using some extensions of
php is a powerful method to generate "metal surfaces". It is used to
vary the color over the area selected for the color. Although one may
consider the color I am going to show closer to brass than gold, it
will at least illustrate the principle.
http://www.cwdjr.net/audio3/bigbasicbutton.php
http://www.cwdjr.net/audio3/bigbasicbutton.png
http://www.cwdjr.net/audio3/playersbutton2.php
http://www.cwdjr.net/audio3/playersbutton2.png
One can use the php code to generate the metal colored object every
time, or output the generate image as a png, jpg, etc.
______________________________________________
I hope the code to follow shows up well on this post. Some browsers,
especially some IE ones, have trouble with showing ph code as text.
PHP code to generate bigbasicbutton follows:
<?php
$image_height = 30;
$image_width = 225;
$image = imagecreate($image_width, $image_height);
$back_color = imagecolorallocate ($image, 200, 200, 200);
$w = 225; // 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);
}
$end_color = imagecolorallocate ($image, 0, 0, 0) ;imageline ($image,
0, 0, 0, $h,$end_color);
imageline ($image, $w, 0, $w, $h,$end_color);
imagecolortransparent($image, $back_color);
header ('Content-Type: image/png');
imagepng ($image);
imagedestroy ($image);
?>
_____________________________________________________
PHP code to write on and add lines to bigbasicbutton follows:
<?php
$image = imagecreatefrompng ("bigbasicbutton.png");
$back_color = imagecolorallocate($image, 200, 200, 200);
$draw_color = imagecolorallocate($image, 0, 0, 0);
imagerectangle($image, 0, 0, imagesx($image), imagesy($image),
$draw_color);
$font_number = 5;
imagestring($image, $font_number, 4, 15 - $font_number-2, 'STOP REAL
SWF MP3 WMP', $draw_color);
$end_color = imagecolorallocate ($image, 0, 0, 0) ;
imagesetthickness ($image, 4);
imageline ($image, 0, 0, 0, 35,$end_color);
imageline ($image, 45, 0, 45, 35,$end_color);
imageline ($image, 90, 0, 90, 35,$end_color);
imageline ($image, 135, 0, 135, 35,$end_color);
imageline ($image, 180, 0, 180, 35,$end_color);
imageline ($image, 224, 0, 224, 35,$end_color);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>