Git Product home page Git Product logo

tinygraphs's Introduction

tinygraphs is an avatar generator web service. Checkout tinygraphs.com to try it.

baby-gopher

Contributors

Blog post:

Building tinygraphs an avatar web service in Go

How to use:

  • You can set the HTML source of the image to point directly to tinygraphs.com
<img src="http://tinygraphs.com/squares/helloworld">
  • You can save the image and use it directly on your site
  • You can go get this repo and use it.

just remember to give us credit with a link to tinygraphs.com ;)

Supported routes:

http://tinygraphs.com/squares/anything

squares squares squares

http://tinygraphs.com/isogrids/helloworld

squares squares squares

http://tinygraphs.com/spaceinvaders/helloworld

squares squares squares

http://tinygraphs.com/squares/banner/random?h=50&xs=100

square random banner

square random banner

square random banner

http://tinygraphs.com/squares/banner/random/gradient?theme=frogideas&xs=100

square random banner

square random banner

square random banner

http://tinygraphs.com/isogrids/banner/random?h=50&xt=100

isogrids random banner

isogrids random banner

isogrids random banner

http://tinygraphs.com/isogrids/banner/random/gradient?theme=frogideas&h=50&xt=100

square random banner

square random banner

square random banner

##Lab routes:

http://tinygraphs.com/labs/checkerboard

checkerboard

http://tinygraphs.com/labs/squares/random

random random random

http://tinygraphs.com/labs/isogrids/random

random random random

http://tinygraphs.com/labs/isogrids/hexa

hexa hexa hexa

http://tinygraphs.com/labs/isogrids/hexa16

hexa16 hexa16 hexa16

http://tinygraphs.com/labs/squares/banner/gradient

gradient colors squares

gradient colors squares

http://tinygraphs.com/labs/isogrids/banner/gradient

gradient colors isogrids

gradient colors isogrids

Parameters:

  • size: tinygraphs.com/squares/hello?size=60

  • formats: tinygraphs.com/squares/hello?fmt=svg

    The default format is SVG.

    All routes support SVG format, except Square routes who also support JPEG.

  • background and foreground: tinygraphs.com/squares/hello?bg=ff4008&fg=04d6f2

    You can specify the color of the background or foreground by using parameters bg and fg and passing an hexadecimal value of the color:

  • theme: tinygraphs.com/labs/squares/random?theme=frogideas

    You can specify the theme you want to take into account in the image.

    theme

    Here is the list of existing themes:

    • theme base
    • theme sugarsweets
    • theme heatwave
    • themedaisygarden
    • theme seascape
    • theme summerwarmth
    • theme bythepool
    • theme duskfalling
    • theme frogideas
    • theme berrypie
  • numcolors: tinygraphs.com/labs/squares/random?theme=summerwarmth&numcolors=4

    You can specify the number of colors that you want to render the image. Default value is 2 and can be extended to 4.

    theme theme theme

  • inv: tinygraphs.com/squares/hello?theme=frogideas&numcolors=2&inv=1

    You can specify if you want to see the colors inverted. Default value is false. inv parameter works with theme colors or default (black and white) colors. The number of colors has to be equal to 2.

    normal inverse

  • order: tinygraphs.com/squares/hello?theme=frogideas&numcolors=4&order=3&order=2&order=1&order=0

    You can specify the order in which you want to see the colors by using the order parameter. Just add the indexes in which you wish to see the colors to the order array (indexes are zero based) Like so: order=3&order=2&order=1&order=0

    normal reorder

  • lines: tinygraphs.com/isogrids/hello?lines=4

You can specify the number of lines that an isogrid can have using the linesparameter. Default parameter is 6. Value has to be greater or equal to 4.

number of lines in isogrid image.

  • colors:

tinygraphs.com/isogrids/hello?lines=4&colors=43e0e8&colors=e84b43 You can specify use you own colors by using the colors parameter and passing hexa colors.

![isogrid with custom colors](http://tinygraphs.com/isogrids/hello?lines=4&size=120&colors=43e0e8&colors=e84b43)
  • banner parameters:

    • h: height parameter.
    • w: width parameter.
    • xt: number of triangles in isogrid banner in x axis.
    • xs: number of squares in squares banner in x axis.
    • theme: tinygraphs theme to use in banner.
    • numcolors: number of colors to take into account when rendering banner.

    tinygraphs.com/isogrids/banner/random/gradient?theme=bythepool&numcolors=4

isogrid gradient banner.

  • random banner parameters:

    • p: probability of the main color in the banner. Default value is 0.5. Values should be between 0 and 1

    tinygraphs.com/labs/isogrids/banner/gradient?theme=bythepool&p=0.1

    isogrid gradient banner.

  • isogrid color gradient parameters

    You can manipulate the gradient vector using the following parameter.

    • gx1: first gradient coordinate along x axis.
    • gy1: first gradient coordinate along y axis.
    • gx2: second gradient coordinate along x axis.
    • gy2: second gradient coordinate along y axis.

    tinygraphs.com/labs/isogrids/banner/gradient?theme=bythepool&xt=4&h=120&w=120&gx1=0&gy1=0&gy2=60&gx2=60

    isogrid color gradient

Stack

  • Go
  • Heroku

Third parties

Installation

go get github.com/taironas/tinygraphs
cd $GOPATH/src/github.com/taironas/tinygraphs
glide install
go build
export PORT=8080

Run App

> pwd
$GOPATH/src/github.com/taironas/tinygraphs
> tinygraphs
2014/11/19 22:23:57 Listening on 8080

Build

>cd $GOPATH/src/github.com/tinygraphs
>go build

Test locally

option 1:

> tinygraphs
2014/12/07 00:35:02 Listening on 8080

option 2:

If you have heroku install you should be able to run

> heroku local
00:37:38 web.1  | started with pid 5762
00:37:38 web.1  | 2014/12/07 00:37:38 Listening on 8080

option 3:

> go test ./...

Deploy

Easy

Deploy

Manual

Note: heroku is now configured to build and deploy any git pushto master. If you still want to manual deploy the app follow the steps below.

Before you start be sure to have the proper rsa key. See Managing Your SSH Keys for more details and that. Also be sure to be logged in with heroku.

> heroku login
Enter your Heroku credentials.
Email: [email protected]
Password:

After that you can deploy as follows:

> git push heroku master
Fetching repository, done.
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 287 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> Go app detected
-----> Using go1.3
-----> Running: go get -tags heroku ./...
-----> Discovering process types
       Procfile declares types -> web

-----> Compressing... done, 1.5MB
-----> Launching... done, v6
       https://tinygraphs.herokuapp.com/ deployed to Heroku

To [email protected]:tinygraphs.git
   56a3000..5572085  master -> master

tinygraphs's People

Contributors

amerine avatar rjourde avatar santiaago avatar sas-lakera avatar taraspos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tinygraphs's Issues

set color themes in tinygraphs

I will start with the following url pattern:

tinygraphs.com/isogrids/hello?theme=sugarsweets

the other option would be:

tinygraphs.com/isogrids/sugarsweets/hello

another option would be:

tinygraphs.com/isogrids/hello/theme/sugarsweets

generate random grid of 6x6 squares of 40px each

URLs with grid a specific color pattern

  • /grid/1
  • /grid/2
  • /grid/3
  • /grid/4
  • /grid/5
  • /grid/6
  • /grid/7
  • /grid/8

URLs with grid of random colors following a color pattern:

  • /grid/random/1
  • /grid/random/2
  • /grid/random/3
  • /grid/random/4
  • /grid/random/5
  • /grid/random/6
  • /grid/random/7
  • /grid/random/8

this generated a gird or 6x6 squares of 40px each with two random colors

make random symmetric images

  • /grid/random/symetric/
  • /grid/random/symetric/x
  • /grid/random/symetric/y
  • /grid/random/symetric/x/[0-8]/
  • /grid/random/symetric/y/[0-8]/

start space invader generator

space invader generator

Variables:

  • ✓ number of legs
  • ✓ number of arms
  • ✓ arm size
  • ✓ number of antennas
  • ✓ antenna size
  • direction of eyes
  • color
  • height of invader
  • ✓ length of invader
  • ✓ direction of arms
  • direction of antennas
  • ✓ feet
  • fangs

support color avatars with anystring pattern

return the same avatar pattern each time with a specific color:

  • tinygraphs.com/grid/square/0/hello
  • tinygraphs.com/grid/square/1/hello
  • tinygraphs.com/grid/square/2/hello
  • tinygraphs.com/grid/square/3/hello

return the same pattern with different colors.

add server side analytics

we would like to track url requests to dynamically generated images.
This http responses cannot/should not have google analytics scripts

support svg

right now we only support jpeg, we should support svg as well.

re order routes.

labs:
labs/isogrids/hexa
labs/isogrids/random
labs/checkerboard
.
.
.

official:
/squares
/isogrids
/spageinvaders

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.