Initialize
This commit is contained in:
4
.htaccess
Normal file
4
.htaccess
Normal file
@@ -0,0 +1,4 @@
|
||||
RewriteEngine On
|
||||
RewriteBase /color-icon/
|
||||
|
||||
RewriteRule ^hex/(.+)$ index.php?hexcol=$1 [NC,L]
|
||||
12
index.php
Normal file
12
index.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$my_img = imagecreate(15, 15);
|
||||
$hexcol = htmlspecialchars($_GET['hexcol']);
|
||||
$r = hexdec(substr($hexcol, 0, 2));
|
||||
$g = hexdec(substr($hexcol, 2, 2));
|
||||
$b = hexdec(substr($hexcol, 4, 2));
|
||||
$background = imagecolorallocate($my_img, $r, $g, $b);
|
||||
header("Content-type: image/png");
|
||||
imagepng($my_img);
|
||||
imagecolordeallocate($my_img, $background);
|
||||
imagedestroy($my_img);
|
||||
die();
|
||||
Reference in New Issue
Block a user