Add cats.
@ -33,7 +33,7 @@ class Robohash(object):
|
||||
#3 = BG
|
||||
self.iter = 4
|
||||
self._create_hashes(hashcount)
|
||||
|
||||
|
||||
self.resourcedir = os.path.dirname(__file__) + '/'
|
||||
# Get the list of backgrounds and RobotSets
|
||||
self.sets = self._listdirs(self.resourcedir + 'sets')
|
||||
@ -53,12 +53,12 @@ class Robohash(object):
|
||||
# This ensures that /Bear.png and /Bear.bmp will send back the same image, in different formats.
|
||||
|
||||
if string.lower().endswith(('.png','.gif','.jpg','.bmp','.jpeg','.ppm','.datauri')):
|
||||
format = string[string.rfind('.') +1 :len(string)]
|
||||
format = string[string.rfind('.') +1 :len(string)]
|
||||
if format.lower() == 'jpg':
|
||||
format = 'jpeg'
|
||||
self.format = format
|
||||
string = string[0:string.rfind('.')]
|
||||
return string
|
||||
format = 'jpeg'
|
||||
self.format = format
|
||||
string = string[0:string.rfind('.')]
|
||||
return string
|
||||
|
||||
|
||||
def _create_hashes(self,count):
|
||||
@ -71,7 +71,7 @@ class Robohash(object):
|
||||
blocksize = int(len(self.hexdigest) / count)
|
||||
currentstart = (1 + i) * blocksize - blocksize
|
||||
currentend = (1 +i) * blocksize
|
||||
self.hasharray.append(int(self.hexdigest[currentstart:currentend],16))
|
||||
self.hasharray.append(int(self.hexdigest[currentstart:currentend],16))
|
||||
|
||||
def _listdirs(self,path):
|
||||
return [d for d in natsort.natsorted(os.listdir(path)) if os.path.isdir(os.path.join(path, d))]
|
||||
@ -90,7 +90,7 @@ class Robohash(object):
|
||||
if name[:1] is not '.':
|
||||
directories.append(os.path.join(root, name))
|
||||
directories = natsort.natsorted(directories)
|
||||
|
||||
|
||||
# Go through each directory in the list, and choose one file from each.
|
||||
# Add this file to our master list of robotparts.
|
||||
for directory in directories:
|
||||
@ -98,7 +98,7 @@ class Robohash(object):
|
||||
for imagefile in natsort.natsorted(os.listdir(directory)):
|
||||
files_in_dir.append(os.path.join(directory,imagefile))
|
||||
files_in_dir = natsort.natsorted(files_in_dir)
|
||||
|
||||
|
||||
# Use some of our hash bits to choose which file
|
||||
element_in_list = self.hasharray[self.iter] % len(files_in_dir)
|
||||
chosen_files.append(files_in_dir[element_in_list])
|
||||
@ -125,7 +125,7 @@ class Robohash(object):
|
||||
|
||||
|
||||
# Only set1 is setup to be color-seletable. The others don't have enough pieces in various colors.
|
||||
# This could/should probably be expanded at some point..
|
||||
# This could/should probably be expanded at some point..
|
||||
# Right now, this feature is almost never used. ( It was < 44 requests this year, out of 78M reqs )
|
||||
|
||||
if roboset == 'set1':
|
||||
@ -139,7 +139,7 @@ class Robohash(object):
|
||||
if bgset in self.bgsets:
|
||||
bgset = bgset
|
||||
elif bgset == 'any':
|
||||
bgset = self.bgsets[ self.hasharray[2] % len(self.bgsets) ]
|
||||
bgset = self.bgsets[ self.hasharray[2] % len(self.bgsets) ]
|
||||
|
||||
# If we set a format based on extension earlier, use that. Otherwise, PNG.
|
||||
if format is None:
|
||||
@ -154,7 +154,7 @@ class Robohash(object):
|
||||
# For instance, the head has to go down BEFORE the eyes, or the eyes would be hidden.
|
||||
|
||||
# First, we'll get a list of parts of our robot.
|
||||
|
||||
|
||||
|
||||
roboparts = self._get_list_of_files(self.resourcedir + 'sets/' + roboset)
|
||||
print(roboparts)
|
||||
@ -169,12 +169,12 @@ class Robohash(object):
|
||||
if not ls.startswith("."):
|
||||
bglist.append(self.resourcedir + 'backgrounds/' + bgset + "/" + ls)
|
||||
background = bglist[self.hasharray[3] % len(bglist)]
|
||||
|
||||
|
||||
# Paste in each piece of the Robot.
|
||||
roboimg = Image.open(roboparts[0])
|
||||
roboimg = roboimg.resize((1024,1024))
|
||||
for png in roboparts:
|
||||
img = Image.open(png)
|
||||
img = Image.open(png)
|
||||
img = img.resize((1024,1024))
|
||||
roboimg.paste(img,(0,0),img)
|
||||
|
||||
@ -183,13 +183,13 @@ class Robohash(object):
|
||||
#Flatten bmps
|
||||
r, g, b, a = roboimg.split()
|
||||
roboimg = Image.merge("RGB", (r, g, b))
|
||||
|
||||
|
||||
if bgset is not None:
|
||||
bg = Image.open(background)
|
||||
bg = bg.resize((1024,1024))
|
||||
bg.paste(roboimg,(0,0),roboimg)
|
||||
roboimg = bg
|
||||
|
||||
self.img = roboimg.resize((sizex,sizey),Image.ANTIALIAS)
|
||||
roboimg = bg
|
||||
|
||||
self.img = roboimg.resize((sizex,sizey),Image.ANTIALIAS)
|
||||
self.format = format
|
||||
|
||||
|
BIN
robohash/sets/set4/000#00body/000#body0.png
Normal file
After Width: | Height: | Size: 292 KiB |
BIN
robohash/sets/set4/000#00body/001#body1.png
Normal file
After Width: | Height: | Size: 535 KiB |
BIN
robohash/sets/set4/000#00body/002#body2.png
Normal file
After Width: | Height: | Size: 254 KiB |
BIN
robohash/sets/set4/000#00body/003#body3.png
Normal file
After Width: | Height: | Size: 317 KiB |
BIN
robohash/sets/set4/000#00body/004#body4.png
Normal file
After Width: | Height: | Size: 305 KiB |
BIN
robohash/sets/set4/000#00body/005#body5.png
Normal file
After Width: | Height: | Size: 359 KiB |
BIN
robohash/sets/set4/000#00body/006#body6.png
Normal file
After Width: | Height: | Size: 294 KiB |
BIN
robohash/sets/set4/000#00body/007#body7.png
Normal file
After Width: | Height: | Size: 303 KiB |
BIN
robohash/sets/set4/000#00body/008#body8.png
Normal file
After Width: | Height: | Size: 313 KiB |
BIN
robohash/sets/set4/000#00body/009#body9.png
Normal file
After Width: | Height: | Size: 394 KiB |
BIN
robohash/sets/set4/000#00body/010#body10.png
Normal file
After Width: | Height: | Size: 381 KiB |
BIN
robohash/sets/set4/000#00body/011#body11.png
Normal file
After Width: | Height: | Size: 280 KiB |
BIN
robohash/sets/set4/000#00body/012#body12.png
Normal file
After Width: | Height: | Size: 562 KiB |
BIN
robohash/sets/set4/000#00body/013#body13.png
Normal file
After Width: | Height: | Size: 298 KiB |
BIN
robohash/sets/set4/000#00body/014#body14.png
Normal file
After Width: | Height: | Size: 294 KiB |
BIN
robohash/sets/set4/001#01fur/000#fur0.png
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
robohash/sets/set4/001#01fur/001#fur1.png
Normal file
After Width: | Height: | Size: 98 KiB |
BIN
robohash/sets/set4/001#01fur/002#fur2.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
robohash/sets/set4/001#01fur/003#fur3.png
Normal file
After Width: | Height: | Size: 180 KiB |
BIN
robohash/sets/set4/001#01fur/004#fur4.png
Normal file
After Width: | Height: | Size: 127 KiB |
BIN
robohash/sets/set4/001#01fur/005#fur5.png
Normal file
After Width: | Height: | Size: 104 KiB |
BIN
robohash/sets/set4/001#01fur/006#fur6.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
robohash/sets/set4/001#01fur/007#fur7.png
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
robohash/sets/set4/001#01fur/008#fur8.png
Normal file
After Width: | Height: | Size: 69 KiB |
BIN
robohash/sets/set4/001#01fur/009#fur9.png
Normal file
After Width: | Height: | Size: 98 KiB |
BIN
robohash/sets/set4/002#02eyes/000#eyes0.png
Normal file
After Width: | Height: | Size: 76 KiB |
BIN
robohash/sets/set4/002#02eyes/001#eyes1.png
Normal file
After Width: | Height: | Size: 58 KiB |
BIN
robohash/sets/set4/002#02eyes/002#eyes2.png
Normal file
After Width: | Height: | Size: 36 KiB |
BIN
robohash/sets/set4/002#02eyes/003#eyes3.png
Normal file
After Width: | Height: | Size: 64 KiB |
BIN
robohash/sets/set4/002#02eyes/004#eyes4.png
Normal file
After Width: | Height: | Size: 99 KiB |
BIN
robohash/sets/set4/002#02eyes/005#eyes5.png
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
robohash/sets/set4/002#02eyes/006#eyes6.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
robohash/sets/set4/002#02eyes/007#eyes7.png
Normal file
After Width: | Height: | Size: 98 KiB |
BIN
robohash/sets/set4/002#02eyes/008#eyes8.png
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
robohash/sets/set4/002#02eyes/009#eyes9.png
Normal file
After Width: | Height: | Size: 89 KiB |
BIN
robohash/sets/set4/002#02eyes/010#eyes10.png
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
robohash/sets/set4/002#02eyes/011#eyes11.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
robohash/sets/set4/002#02eyes/012#eyes12.png
Normal file
After Width: | Height: | Size: 117 KiB |
BIN
robohash/sets/set4/002#02eyes/013#eyes13.png
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
robohash/sets/set4/002#02eyes/014#eyes14.png
Normal file
After Width: | Height: | Size: 89 KiB |
BIN
robohash/sets/set4/003#03mouth/000#mouth0.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
robohash/sets/set4/003#03mouth/001#mouth1.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
robohash/sets/set4/003#03mouth/002#mouth2.png
Normal file
After Width: | Height: | Size: 33 KiB |
BIN
robohash/sets/set4/003#03mouth/003#mouth3.png
Normal file
After Width: | Height: | Size: 53 KiB |
BIN
robohash/sets/set4/003#03mouth/004#mouth4.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
robohash/sets/set4/003#03mouth/005#mouth5.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
robohash/sets/set4/003#03mouth/006#mouth6.png
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
robohash/sets/set4/003#03mouth/007#mouth7.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
robohash/sets/set4/003#03mouth/008#mouth8.png
Normal file
After Width: | Height: | Size: 52 KiB |
BIN
robohash/sets/set4/003#03mouth/009#mouth9.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
robohash/sets/set4/004#04accessories/000#accessory0.png
Normal file
After Width: | Height: | Size: 166 KiB |
BIN
robohash/sets/set4/004#04accessories/001#accessory1.png
Normal file
After Width: | Height: | Size: 54 KiB |
BIN
robohash/sets/set4/004#04accessories/002#accessory2.png
Normal file
After Width: | Height: | Size: 57 KiB |
BIN
robohash/sets/set4/004#04accessories/003#accessory3.png
Normal file
After Width: | Height: | Size: 130 KiB |
BIN
robohash/sets/set4/004#04accessories/004#accessory4.png
Normal file
After Width: | Height: | Size: 100 KiB |
BIN
robohash/sets/set4/004#04accessories/005#accessory5.png
Normal file
After Width: | Height: | Size: 101 KiB |
BIN
robohash/sets/set4/004#04accessories/006#accessory6.png
Normal file
After Width: | Height: | Size: 171 KiB |
BIN
robohash/sets/set4/004#04accessories/007#accessory7.png
Normal file
After Width: | Height: | Size: 137 KiB |
BIN
robohash/sets/set4/004#04accessories/008#accessory8.png
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
robohash/sets/set4/004#04accessories/009#accessory9.png
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
robohash/sets/set4/004#04accessories/010#accessory10.png
Normal file
After Width: | Height: | Size: 90 KiB |
BIN
robohash/sets/set4/004#04accessories/011#accessory11.png
Normal file
After Width: | Height: | Size: 249 KiB |
BIN
robohash/sets/set4/004#04accessories/012#accessory12.png
Normal file
After Width: | Height: | Size: 102 KiB |
BIN
robohash/sets/set4/004#04accessories/013#accessory13.png
Normal file
After Width: | Height: | Size: 119 KiB |
BIN
robohash/sets/set4/004#04accessories/014#accessory14.png
Normal file
After Width: | Height: | Size: 195 KiB |
BIN
robohash/sets/set4/004#04accessories/015#accessory15.png
Normal file
After Width: | Height: | Size: 27 KiB |
@ -15,7 +15,7 @@ colin@robohash.org
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<title>RoboHash</title>
|
||||
<link href="/static/css/main.css" rel="stylesheet" type="text/css" />
|
||||
@ -81,24 +81,24 @@ $(document).ready(function(){
|
||||
|
||||
<script type='text/javascript'>
|
||||
$(function() {
|
||||
|
||||
|
||||
$('#example-1').tipsy();
|
||||
|
||||
|
||||
$('#north').tipsy({gravity: 'n'});
|
||||
$('#south').tipsy({gravity: 's'});
|
||||
$('#east').tipsy({gravity: 'e'});
|
||||
$('#west').tipsy({gravity: 'w'});
|
||||
|
||||
|
||||
$('#auto-gravity').tipsy({gravity: $.fn.tipsy.autoNS});
|
||||
|
||||
|
||||
$('.fade').tipsy({fade: true});
|
||||
|
||||
|
||||
$('#example-custom-attribute').tipsy({title: 'id'});
|
||||
$('#example-callback').tipsy({title: function() { return this.getAttribute('original-title').toUpperCase(); } });
|
||||
$('#example-fallback').tipsy({fallback: "?" });
|
||||
|
||||
|
||||
$('#example-html').tipsy({html: true });
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -114,7 +114,7 @@ $(document).ready(function(){
|
||||
|
||||
<!-- start of top logo -->
|
||||
<div id="top_logo">
|
||||
|
||||
|
||||
|
||||
<img src="//robohash.org/static/img/top_logo.png" width="375" height="151" alt="logo" id="toc"/></div><!-- end of top logo -->
|
||||
|
||||
@ -167,22 +167,22 @@ $(document).ready(function(){
|
||||
<div class="section_title">How cool is this?</div>
|
||||
<p> That guy to your left there? He was specially generated from your IP address <i>Just for you.</i></p>
|
||||
<div class="container" >
|
||||
<div class="contain-right" style="width:60%; float:right;">
|
||||
<div class="contain-right" style="width:60%; float:right;">
|
||||
<p>Try on your phone, and I bet you get someone different!</p>
|
||||
<p>Keep scrolling down to see some more freshly-assembled RoboHashes.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
<script type="text/javascript">
|
||||
|
||||
function stopRKey(evt) {
|
||||
var evt = (evt) ? evt : ((event) ? event : null);
|
||||
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
|
||||
if ((evt.keyCode == 13) && (node.type=="text")) {submitform(); return false;}
|
||||
}
|
||||
function stopRKey(evt) {
|
||||
var evt = (evt) ? evt : ((event) ? event : null);
|
||||
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
|
||||
if ((evt.keyCode == 13) && (node.type=="text")) {submitform(); return false;}
|
||||
}
|
||||
|
||||
document.onkeypress = stopRKey;
|
||||
document.onkeypress = stopRKey;
|
||||
|
||||
</script>
|
||||
|
||||
@ -202,7 +202,7 @@ function submitform()
|
||||
|
||||
|
||||
</div>
|
||||
<div class="contain-left" >
|
||||
<div class="contain-left" >
|
||||
<img src="//robohash.org/static/img/down-arrow.png" alt="Scroll down!" height=200 class="left" />
|
||||
</div>
|
||||
</div>
|
||||
@ -229,7 +229,7 @@ function submitform()
|
||||
<img src="//robohash.org/static/img/star.png" width="33" height="31" alt="1 star" />
|
||||
<img src="//robohash.org/static/img/star.png" width="33" height="31" alt="1 star" />
|
||||
<img src="//robohash.org/static/img/star.png" width="33" height="31" alt="1 star" />
|
||||
<img src="//robohash.org/static/img/star.png" width="33" height="31" alt="1 star" />
|
||||
<img src="//robohash.org/static/img/star.png" width="33" height="31" alt="1 star" />
|
||||
<br />
|
||||
<span class="large_quote">{{drquote1[0]}}</span>
|
||||
<br />
|
||||
@ -269,7 +269,7 @@ function submitform()
|
||||
{% set c3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set1" %}
|
||||
{% set c4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set1" %}
|
||||
{% set c5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set1" %}
|
||||
|
||||
|
||||
<li><a href="//robohash.org/{{c1}}" rel="prettyPhoto[gallery1]"
|
||||
title="{{random.choice(quotes)}}" class="fade"><img src="//robohash.org/{{c1}}&size=150x150" width="150" height="150"/></a></li>
|
||||
<li><a href="//robohash.org/{{c2}}" rel="prettyPhoto[gallery1]"
|
||||
@ -293,16 +293,16 @@ function submitform()
|
||||
|
||||
<!-- start of content section -->
|
||||
<div class="content_section">
|
||||
|
||||
|
||||
<p>By appending ?set=set2 to our Image's URLs, we are able to generate a whole slew of Random monsters. Here are 5 we picked out for you. </p>
|
||||
|
||||
|
||||
<ul class="gallery">
|
||||
{% set c1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set2" %}
|
||||
{% set c2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set2" %}
|
||||
{% set c3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set2" %}
|
||||
{% set c4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set2" %}
|
||||
{% set c5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set2" %}
|
||||
|
||||
|
||||
<li><a href="//robohash.org/{{c1}}" rel="prettyPhoto[gallery1]"
|
||||
title="{{random.choice(quotes)}}" class="fade"><img src="//robohash.org/{{c1}}&size=150x150" width="150" height="150" /></a></li>
|
||||
<li><a href="//robohash.org/{{c2}}" rel="prettyPhoto[gallery1]"
|
||||
@ -326,16 +326,16 @@ function submitform()
|
||||
|
||||
<!-- start of content section -->
|
||||
<div class="content_section">
|
||||
|
||||
|
||||
<p>By appending ?set=set3 to our URLs, we get back to robots. New, suave, disembodied heads. That's sexy. Like a robot. </p>
|
||||
|
||||
|
||||
<ul class="gallery">
|
||||
{% set c1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set3" %}
|
||||
{% set c2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set3" %}
|
||||
{% set c3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set3" %}
|
||||
{% set c4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set3" %}
|
||||
{% set c5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set3" %}
|
||||
|
||||
|
||||
<li><a href="//robohash.org/{{c1}}" rel="prettyPhoto[gallery1]"
|
||||
title="{{random.choice(quotes)}}" class="fade"><img src="//robohash.org/{{c1}}&size=150x150" width="150" height="150" /></a></li>
|
||||
<li><a href="//robohash.org/{{c2}}" rel="prettyPhoto[gallery1]"
|
||||
@ -352,6 +352,37 @@ function submitform()
|
||||
|
||||
<div class="hr"></div>
|
||||
|
||||
<!-- *************************************************************************
|
||||
****************************** GALLERY3 SECTION *****************************
|
||||
************************************************************************** -->
|
||||
|
||||
<!-- start of content section -->
|
||||
<div class="content_section">
|
||||
|
||||
<p>By appending ?set=set4 to our URLs, we can hydroponically grow beautiful kittens. </p>
|
||||
|
||||
<ul class="gallery">
|
||||
{% set c1 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set4" %}
|
||||
{% set c2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set4" %}
|
||||
{% set c3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set4" %}
|
||||
{% set c4 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set4" %}
|
||||
{% set c5 = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(3)) + ".png?set=set4" %}
|
||||
|
||||
<li><a href="//robohash.org/{{c1}}" rel="prettyPhoto[gallery1]"
|
||||
title="{{random.choice(catquotes)}}" class="fade"><img src="//robohash.org/{{c1}}&size=150x150" width="150" height="150" /></a></li>
|
||||
<li><a href="//robohash.org/{{c2}}" rel="prettyPhoto[gallery1]"
|
||||
title="{{random.choice(catquotes)}}" class="fade"><img src="//robohash.org/{{c2}}&size=150x150" width="150" height="150" /></a></li>
|
||||
<li><a href="//robohash.org/{{c3}}" rel="prettyPhoto[gallery1]"
|
||||
title="{{random.choice(catquotes)}}" class="fade"><img src="//robohash.org/{{c3}}&size=150x150" width="150" height="150" /></a></li>
|
||||
<li><a href="//robohash.org/{{c4}}" rel="prettyPhoto[gallery1]"
|
||||
title="{{random.choice(catquotes)}}" class="fade"><img src="//robohash.org/{{c4}}&size=150x150" width="150" height="150" /></a></li>
|
||||
<li><a href="//robohash.org/{{c5}}" rel="prettyPhoto[gallery1]"
|
||||
title="{{random.choice(catquotes)}}" class="fade"><img src="//robohash.org/{{c5}}&size=150x150" width="150" height="150" /></a></li>
|
||||
</ul>
|
||||
|
||||
</div><!-- end of content section -->
|
||||
|
||||
<div class="hr"></div>
|
||||
|
||||
|
||||
|
||||
@ -368,62 +399,62 @@ function submitform()
|
||||
<div class="left_content">
|
||||
|
||||
<!-- ********** BENEFITS ITEM 1 ********** -->
|
||||
|
||||
|
||||
<!-- start of benefit item -->
|
||||
<div class="benefit">
|
||||
|
||||
<img src="//robohash.org/static/img/star_icon.jpg" width="73" height="72" alt="Super Easy to use" class="left"/>
|
||||
|
||||
|
||||
<!-- start of benefit right -->
|
||||
<div class="benefit_right">
|
||||
|
||||
|
||||
<span class="benefit_header">Super Easy</span>
|
||||
<p>Anytime you need a Robohash, just embed <br> <img src="https://robohash.org/YOUR-TEXT.png"><br></p>
|
||||
|
||||
|
||||
</div><!-- end of benefit right -->
|
||||
|
||||
|
||||
</div><!-- end of benefit item -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ********** BENEFITS ITEM 2 ********** -->
|
||||
|
||||
|
||||
<!-- start of benefit item -->
|
||||
<div class="benefit">
|
||||
|
||||
<img src="//robohash.org/static/img/report_icon.jpg" width="73" height="72" alt="Supported Formats" class="left"/>
|
||||
|
||||
|
||||
<!-- start of benefit right -->
|
||||
<div class="benefit_right">
|
||||
|
||||
|
||||
<span class="benefit_header">Styles of Robot</span>
|
||||
<p>Want a JPG instead? Fine. PNG? Fine. Want it as a bitmap? I think you're nutty. But fine. Just change the
|
||||
URL to request in any format you want. Use ?ignoreext=false to make the bots care about extensions.</p>
|
||||
|
||||
|
||||
</div><!-- end of benefit right -->
|
||||
|
||||
|
||||
</div><!-- end of benefit item -->
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- ********** BENEFITS ITEM 3 ********** -->
|
||||
|
||||
|
||||
<!-- start of benefit item -->
|
||||
<div class="benefit">
|
||||
|
||||
<img src="//robohash.org/static/img/tut_icon.jpg" width="73" height="72" alt="Very infrequent murderous rampages." class="left"/>
|
||||
|
||||
|
||||
<!-- start of benefit right -->
|
||||
<div class="benefit_right">
|
||||
|
||||
|
||||
<span class="benefit_header">Very Infrequent Rampages</span>
|
||||
<p>Due to Robot caching modules and CDN usage, our robots stay speedy, and only rarely go on murderous rampages. That's a Fact!</p>
|
||||
|
||||
|
||||
</div><!-- end of benefit right -->
|
||||
|
||||
|
||||
</div><!-- end of benefit item -->
|
||||
|
||||
|
||||
|
||||
|
||||
</div><!-- end of left content section -->
|
||||
|
||||
|
||||
@ -432,80 +463,80 @@ function submitform()
|
||||
<div class="right_content">
|
||||
|
||||
<!-- ********** BENEFITS ITEM 1 ********** -->
|
||||
|
||||
|
||||
<!-- start of benefit item -->
|
||||
<div class="benefit">
|
||||
|
||||
<img src="//robohash.org/static/img/share_icon.jpg" width="73" height="72" alt="3 classes to choose from" class="left"/>
|
||||
|
||||
|
||||
<!-- start of benefit right -->
|
||||
<div class="benefit_right">
|
||||
|
||||
|
||||
<span class="benefit_header">Built in multiple sizes</span>
|
||||
<p>From destroying skyscrapers to nonobots, we've got you covered. Try appending ?size=200x200</p>
|
||||
</div><!-- end of benefit right -->
|
||||
|
||||
|
||||
</div><!-- end of benefit item -->
|
||||
|
||||
|
||||
<!-- ********** BENEFITS ITEM 2 ********** -->
|
||||
|
||||
|
||||
<!-- start of benefit item -->
|
||||
<div class="benefit">
|
||||
|
||||
<img src="//robohash.org/static/img/usability_icon.jpg" width="73" height="72" alt="Robots on Vacation" class="left"/>
|
||||
|
||||
|
||||
<!-- start of benefit right -->
|
||||
<div class="benefit_right">
|
||||
|
||||
|
||||
<span class="benefit_header">Robots at your Location</span>
|
||||
<p>Our robots like to travel. If you append ?bgset=bg1 (or bg2 or any) to your URL, our robots will add a background as part of the hash.</p>
|
||||
|
||||
|
||||
</div><!-- end of benefit right -->
|
||||
|
||||
|
||||
</div><!-- end of benefit item -->
|
||||
|
||||
|
||||
<!-- ********** BENEFITS ITEM 3 ********** -->
|
||||
|
||||
|
||||
<!-- start of benefit item -->
|
||||
<div class="benefit">
|
||||
|
||||
<img src="//robohash.org/static/img/usability_icon.jpg" width="73" height="72" alt="Robotic Values" class="left"/>
|
||||
|
||||
|
||||
<!-- start of benefit right -->
|
||||
<div class="benefit_right">
|
||||
|
||||
|
||||
<span class="benefit_header">Robotic Value</span>
|
||||
<p>Robohash.org robots believe in Family, Warmth, and killing-all-humans. To that end, we provide this service for free. </p>
|
||||
|
||||
|
||||
</div><!-- end of benefit right -->
|
||||
|
||||
|
||||
</div><!-- end of benefit item -->
|
||||
|
||||
|
||||
</div><!-- end of right content section -->
|
||||
|
||||
</div><!-- end of content section -->
|
||||
|
||||
</div><!-- end of content section -->
|
||||
|
||||
<div class="hr"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- start of content section -->
|
||||
<div class="content_section">
|
||||
|
||||
<div class="section_title">Everyone needs Robots!</div>
|
||||
<p>
|
||||
RoboHash.org is here because Robots are funny, and because I needed the algorithm/art anyway for a Super-Awesome new forum I'm working on. If you use a specific set, or a list of them, like "?sets=1,3" , it'll probably stay the same as it is now. If you use "set=any", it'll include any new sets I happen to add, so existing hashes may change. </p><p>
|
||||
|
||||
|
||||
You should email me -
|
||||
|
||||
|
||||
<a href="mailto:colin@robohash.org" class="fade" title="I am probably not a robot.">colin@robohash.org</a>
|
||||
</p><p>
|
||||
|
||||
|
||||
If the bandwidth gets crazy, I might add a [Robohash.org] banner to the bottom of the image. But it'd be super-tasteful.<br>
|
||||
</p>
|
||||
|
||||
</div><!-- end of content section -->
|
||||
|
||||
|
||||
|
||||
<!-- start of content section -->
|
||||
<div class="content_section">
|
||||
|
||||
@ -517,7 +548,6 @@ function submitform()
|
||||
Put either the email, or the hashed version, in your image where the string normally goes -<br><br>
|
||||
For example: https://robohash.org/colin@robohash.org?gravatar=yes<br> or https://robohash.org/620050a4db5104bae758cd75171d64ca?gravatar=hashed
|
||||
</p><p>
|
||||
<p>Both traditional and new Stealthy (https) robots are available.</p>
|
||||
<p>We've also conditioned our robots to accept commands either via params or directories-<br> For instance https://robohash.org/set_set3/bgset_bg1/3.14159?size=500x500
|
||||
<p>Finally, the <a href="https://github.com/e1ven/Robohash">Blueprints are available</a> to build your own robotic
|
||||
factory.</p>
|
||||
@ -528,12 +558,12 @@ function submitform()
|
||||
|
||||
|
||||
<div class="hr"></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div><!-- end of wrapper -->
|
||||
<!-- *************************************************************************
|
||||
****************************** FOOTER SECTION ******************************
|
||||
@ -546,9 +576,10 @@ function submitform()
|
||||
<!-- start of footer container -->
|
||||
<div id="footer_container">
|
||||
<!-- start of footer left -->
|
||||
<div id="footer_left" style="margin-top:60px;">
|
||||
<div id="footer_left" style="margin-top:60px;">
|
||||
<p>
|
||||
Robohash contains robots created by Zikri Kader (set1), Hrvoje Novakovic (set2), and Julian Peter Arias (set3).
|
||||
Robohash contains robots created by Zikri Kader (set1), Hrvoje Novakovic (set2), and Julian Peter Arias (set3).<br>
|
||||
Cats are created by <a href="https://framagit.org/Deevad/cat-avatar-generator/tree/master">David Revoy</a>.
|
||||
<br>
|
||||
<p>
|
||||
You are free to embed under the terms of the CC-BY license. <br> Example wording might be "Robots lovingly delivered by
|
||||
|
@ -39,7 +39,7 @@ define("port", default=80, help="run on the given port", type=int)
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
def get(self):
|
||||
ip = self.request.remote_ip
|
||||
|
||||
|
||||
robo = [
|
||||
"""
|
||||
, ,
|
||||
@ -133,7 +133,7 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
/ \\ / \\
|
||||
|_____| |_____|
|
||||
|HHHHH| |HHHHH|
|
||||
""",
|
||||
""",
|
||||
""" () ()
|
||||
\\ /
|
||||
__\\___________/__
|
||||
@ -163,15 +163,15 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
/ __ \\ / __ \\
|
||||
OO OO OO OO
|
||||
"""]
|
||||
|
||||
|
||||
|
||||
quotes = ["But.. I love you!",
|
||||
"Please don't leave the site.. When no one's here.. It gets dark...",
|
||||
"Script error on line 148",
|
||||
"'Don't trust the other robots. I'm the only trustworthy one.",
|
||||
"Don't trust the other robots. I'm the only trustworthy one.",
|
||||
"My fuel is the misery of children. And Rum. Mostly Rum.",
|
||||
"When they said they'd give me a body transplant, I didn't think they meant this!",
|
||||
"Subject 14 has had it's communication subroutines deleted for attempting suicide.",
|
||||
"Subject 14 has had it's communication subroutines deleted for attempting self-destruction.",
|
||||
"I am the cleverest robot on the whole page.",
|
||||
"Oil can",
|
||||
"I am fleunt in over 6 million forms of communishin.",
|
||||
@ -207,8 +207,19 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
("The robots are all so.. Normal!","Joanna Eberhart, Beta tester"),
|
||||
("Man shouldn't know where their robots come from.","Dr. N. Soong, FutureBeat")]
|
||||
|
||||
catquotes = [("I can haz.. What she's hazing."),
|
||||
("I'm not grumpy, I'm just drawn that way."),
|
||||
("Hakuna Mañana."),
|
||||
("I'm 40% poptart."),
|
||||
("You're desthpicable."),
|
||||
("I've never trusted toadstools, but I suppose some must have their good points."),
|
||||
("We're all mad here - Particularly you."),
|
||||
("Longcat is.. Descriptively named."),
|
||||
("It is fun to have fun, but you have to know meow."),
|
||||
("Who knows the term man-cub but not baby?")]
|
||||
|
||||
random.shuffle(drquotes)
|
||||
self.write(self.render_string('templates/root.html',ip=ip,robo=random.choice(robo),drquote1=drquotes[1],drquote2=drquotes[2],quotes=quotes))
|
||||
self.write(self.render_string('templates/root.html',ip=ip,robo=random.choice(robo),drquote1=drquotes[1],drquote2=drquotes[2],quotes=quotes,catquotes=catquotes))
|
||||
|
||||
class ImgHandler(tornado.web.RequestHandler):
|
||||
"""
|
||||
@ -216,7 +227,7 @@ class ImgHandler(tornado.web.RequestHandler):
|
||||
called as Robohash.org/$1, where $1 becomes the seed string for the Robohash obj
|
||||
"""
|
||||
def get(self,string=None):
|
||||
|
||||
|
||||
|
||||
# Set default values
|
||||
sizex = 300
|
||||
@ -227,7 +238,7 @@ class ImgHandler(tornado.web.RequestHandler):
|
||||
|
||||
# Normally, we pass in arguments with standard HTTP GET variables, such as
|
||||
# ?set=any and &size=100x100
|
||||
#
|
||||
#
|
||||
# Some sites don't like this though.. They cache it weirdly, or they just don't allow GET queries.
|
||||
# Rather than trying to fix the intercows, we can support this with directories... <grumble>
|
||||
# We'll translate /abc.png/s_100x100/set_any to be /abc.png?set=any&s=100x100
|
||||
@ -243,7 +254,7 @@ class ImgHandler(tornado.web.RequestHandler):
|
||||
else:
|
||||
args[k] = ""
|
||||
|
||||
# Detect if they're using the above slash-separated parameters..
|
||||
# Detect if they're using the above slash-separated parameters..
|
||||
# If they are, then remove those parameters from the query string.
|
||||
# If not, don't remove anything.
|
||||
split = string.split('/')
|
||||
@ -274,8 +285,8 @@ class ImgHandler(tornado.web.RequestHandler):
|
||||
sizex = 300
|
||||
if sizey > 4096 or sizey < 0:
|
||||
sizey = 300
|
||||
|
||||
# Allow Gravatar lookups -
|
||||
|
||||
# Allow Gravatar lookups -
|
||||
# This allows people to pass in a gravatar-style hash, and return their gravatar image, instead of a Robohash.
|
||||
# This is often used for example, to show a Gravatar if it's set for an email, or a Robohash if not.
|
||||
if args.get('gravatar','').lower() == 'yes':
|
||||
@ -288,16 +299,16 @@ class ImgHandler(tornado.web.RequestHandler):
|
||||
default = "404"
|
||||
gravatar_url = "https://secure.gravatar.com/avatar/" + string + "?"
|
||||
gravatar_url += urlencode({'default':default, 'size':str(sizey)})
|
||||
|
||||
|
||||
# If we do want a gravatar, request one. If we can't get it, just keep going, and return a robohash
|
||||
if args.get('gravatar','').lower() in ['hashed','yes']:
|
||||
try:
|
||||
f = urlopen(gravatar_url)
|
||||
self.redirect(gravatar_url, permanent=False)
|
||||
self.redirect(gravatar_url, permanent=False)
|
||||
return
|
||||
except:
|
||||
args['avatar'] = False
|
||||
|
||||
|
||||
# Create our Robohashing object
|
||||
r = Robohash(string)
|
||||
|
||||
@ -309,7 +320,11 @@ class ImgHandler(tornado.web.RequestHandler):
|
||||
if args.get('set',r.sets[0]) in r.sets:
|
||||
roboset = args.get('set',r.sets[0])
|
||||
elif args.get('set',r.sets[0]) == 'any':
|
||||
roboset = r.sets[r.hasharray[1] % len(r.sets) ]
|
||||
# Add ugly hack.
|
||||
# Adding cats, per issue-17, but I don't want to change existing hashes.
|
||||
# so we'll ignore that set for the 'any' config.
|
||||
|
||||
roboset = r.sets[r.hasharray[1] % (len(r.sets)-1) ]
|
||||
else:
|
||||
roboset = r.sets[0]
|
||||
|
||||
@ -325,7 +340,7 @@ class ImgHandler(tornado.web.RequestHandler):
|
||||
|
||||
|
||||
# Only set1 is setup to be color-seletable. The others don't have enough pieces in various colors.
|
||||
# This could/should probably be expanded at some point..
|
||||
# This could/should probably be expanded at some point..
|
||||
# Right now, this feature is almost never used. ( It was < 44 requests this year, out of 78M reqs )
|
||||
|
||||
if args.get('color') in r.colors:
|
||||
@ -340,7 +355,7 @@ class ImgHandler(tornado.web.RequestHandler):
|
||||
# Allow them to set a background, or keep as None
|
||||
if args.get('bgset') in r.bgsets + ['any']:
|
||||
bgset = args.get('bgset')
|
||||
|
||||
|
||||
# We're going to be returning the image directly, so tell the browser to expect a binary.
|
||||
self.set_header("Content-Type", "image/" + format)
|
||||
self.set_header("Cache-Control", "public,max-age=31536000")
|
||||
|