diff --git a/awesome/README b/awesome/README new file mode 100644 index 0000000..7394f2b --- /dev/null +++ b/awesome/README @@ -0,0 +1 @@ +Forcing Git to recognize this folder, disregard. diff --git a/css/example.css b/css/example.css index 3ef4131..fae0a06 100644 --- a/css/example.css +++ b/css/example.css @@ -20,7 +20,6 @@ html { } body { - position: relative; text-align: left; width: 600px; margin: 10px auto; @@ -32,7 +31,30 @@ h1 { color: #fff; } -#footer, #container_top, #container_bottom { +#container_top { position: relative; } + +#upload_button { + display: block; + width: 120px; + position: absolute; + top: 0; + right: 17px; /* Laziness */ + padding: 5px; + background-color: #4FA36D; + color: #fff; + text-align: center; + font-size: 1em; + line-height: 1.2em; + -moz-border-radius-bottomleft: 4px; + -moz-border-radius-bottomright: 4px; +} + +#upload_button:hover { + text-decoration: none; + background-color: #43895c; +} + +#options, #footer, #container_top, #container_bottom { background-color: #404d59; margin: 10px auto 5px; text-align: left; @@ -41,11 +63,15 @@ h1 { -webkit-border-radius: 6px; -moz-border-radius: 6px; float: left; + clear: left; } #container_bottom { display: none; } +#footer { text-align: center; margin-bottom: 30px; font-size: 1.2em; line-height: 1.4em; } -#footer { text-align: center; font-size: 1.2em; line-height: 1.4em; } +#options { display: none; padding-top: 6px; } + +#options a:first-child { margin-left: 66px; /* Huzzah for decent CSS support, but horrid CSS right here. :D */ } a, a:visited { color: #f4d496; text-decoration: none; } a:hover { text-decoration: underline; } @@ -67,16 +93,16 @@ a:hover { text-decoration: underline; } #interface { float: right; width: 460px; - margin-top: 23px; + margin-top: 35px; } -#interface p { +#uploader { display: none; } + +#interface p, #hsv { font: normal 1.2em/1.5em helvetica, sans-serif; padding: 4px 1px; } -#hsv a { margin-top: 4px; } - #img_input { border: 1px solid #c9c9c9; padding: 4px; @@ -86,7 +112,7 @@ a:hover { text-decoration: underline; } width: 370px; } -#img_submit, #hsv a { +.img_submit, #hsv a { border: 1px solid #55a2c9; background-color: #498fb2; color: #fff; @@ -94,15 +120,17 @@ a:hover { text-decoration: underline; } -moz-border-radius: 4px; -webkit-border-radius: 4px; } + #hsv a { display: block; - width: 104px; - padding: 0 5px; + width: 120px; + padding: 3px 5px; text-align: center; float: left; margin-right: 15px; text-decoration: none; } + #try_these { clear: both; } diff --git a/index.html b/index.html deleted file mode 100644 index b76563f..0000000 --- a/index.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Franz - client side color palettes from logos - - - - - - - -

Franz - client side color swatches

- -
-
- - -
- -
-
- - -
-

Sort Hue Sort Saturation Sort Value

-

Try out: lol.png, testjubs.jpg, stars.jpg, 1600.jpg, fallout.jpg

- -
- - -
- -
-
- -
-
- - - - - diff --git a/index.php b/index.php new file mode 100644 index 0000000..f7e40a5 --- /dev/null +++ b/index.php @@ -0,0 +1,127 @@ + + + + + Franz - client side color palettes from logos + + + + + + + +

Franz - client side color swatches

+ +
+ Upload an image +
+ + +
+ +
+
+ + +
+
+ + +
+

Try out: + lol.png, + testjubs.jpg, + stars.jpg, + 1600.jpg, + fallout.jpg +

+ +
+ + +
+ +
+

+ Sort by Hue + Sort by Saturation + Sort by Value +

+
+ +
+
+ +
+
+ + + + + diff --git a/upload.php b/upload.php new file mode 100644 index 0000000..230632f --- /dev/null +++ b/upload.php @@ -0,0 +1,48 @@ +_> +$uploadForm = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'index.html'; + +// Self explanatory, I would think. +$fieldname = 'dragonfruit'; + +// Possible upload errors, have some fun here. +$errors = array(1 => 'WTF were you thinking? php.ini max file size was exceeded. Get with the program.', + 2 => 'You have *got* to be kidding me - you exceeded the maximum html form file size!', + 3 => 'Come on now, that file upload was only partial. (Try again)', + 4 => 'Uhh... hello? No file was attached.'); + +// Check with PHP's built-in uploading errors +($_FILES[$fieldname]['error'] == 0) or error($errors[$_FILES[$fieldname]['error']]); + +// Make sure this was really an HTTP upload +@is_uploaded_file($_FILES[$fieldname]['tmp_name']) or error('Not an HTTP upload... (Go back and try again?)'); + +// Validation hack - just run it through getimagesize() ;) +@getimagesize($_FILES[$fieldname]['tmp_name']) or error('Only image uploads are allowed. (Go back and try again)'); + +// We need a unique filename. Judge it off the date and such, should prevent 99% of the same-name errors. +$now = time(); +while(file_exists($uploadFilename = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name'])) { + $now++; +} + +// Move to the final location and actually rename. +@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename) or error('We have received insufficient permissions. Locked on and ready to fire! (Go back and try again)'); + +// Redirect to a success page. If we posted this through JS/Iframe or Flash, you'd wanna just return the string filename. +header('Location: index.php?image=' . $now . '-' . $_FILES[$fieldname]['name']); + +// Generic error handler. Fuck PHP. +function error($error) { + echo $error; + exit; +} + +?>