Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Colour-bars-Display/PHP/colour-bars-display-1.php
Normal file
25
Task/Colour-bars-Display/PHP/colour-bars-display-1.php
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
$colors = array(array( 0, 0, 0), // black
|
||||
array(255, 0, 0), // red
|
||||
array( 0, 255, 0), // green
|
||||
array( 0, 0, 255), // blue
|
||||
array(255, 0, 255), // magenta
|
||||
array( 0, 255, 255), // cyan
|
||||
array(255, 255, 0), // yellow
|
||||
array(255, 255, 255)); // white
|
||||
|
||||
define('BARWIDTH', 640 / count($colors));
|
||||
define('HEIGHT', 480);
|
||||
|
||||
$image = imagecreate(BARWIDTH * count($colors), HEIGHT);
|
||||
|
||||
foreach ($colors as $position => $color) {
|
||||
$color = imagecolorallocate($image, $color[0], $color[1], $color[2]);
|
||||
imagefilledrectangle($image, $position * BARWIDTH, 0,
|
||||
$position * BARWIDTH + BARWIDTH - 1,
|
||||
HEIGHT - 1, $color);
|
||||
}
|
||||
|
||||
header('Content-type:image/png');
|
||||
imagepng($image);
|
||||
imagedestroy($image);
|
||||
17
Task/Colour-bars-Display/PHP/colour-bars-display-2.php
Normal file
17
Task/Colour-bars-Display/PHP/colour-bars-display-2.php
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
$colors = array(
|
||||
"000000", // black
|
||||
"FF0000", // red
|
||||
"00FF00", // green
|
||||
"0000FF", // blue
|
||||
"FF00FF", // magenta
|
||||
"00FFFF", // cyan
|
||||
"FFFF00", // yellow
|
||||
"FFFFFF", // white
|
||||
);
|
||||
|
||||
echo '<table style="border: 1px solid black; border-spacing: 0;"><tr>';
|
||||
foreach ($colors as $color) {
|
||||
echo '<td style="background-color: #'.$color.'; height: 100px; width: 20px;"></td>';
|
||||
}
|
||||
echo '</tr></table>';
|
||||
Loading…
Add table
Add a link
Reference in a new issue