Update documentation & README for renders

This commit is contained in:
Jake 2014-12-05 20:19:08 -06:00
parent 2873157e97
commit f674775520
3 changed files with 53 additions and 20 deletions

View File

@ -5,7 +5,7 @@ https://crafatar.com
Crafatar serves Minecraft avatars based on the skin for use in external applications. Crafatar serves Minecraft avatars based on the skin for use in external applications.
Inspired by [Gravatar](https://gravatar.com) (hence the name) and [Minotar](https://minotar.net). Inspired by [Gravatar](https://gravatar.com) (hence the name) and [Minotar](https://minotar.net).
Image manipulation is done by [lwip](https://github.com/EyalAr/lwip) Image manipulation is done by [lwip](https://github.com/EyalAr/lwip). Renders are created with [node-canvas](https://github.com/Automattic/node-canvas), based on math by [confuser](https://github.com/confuser/serverless-mc-skin-viewer).
![redstone_sheep's avatar](https://crafatar.com/avatars/ae795aa86327408e92ab25c8a59f3ba1?size=128) ![Jake0oo0's avatar](https://crafatar.com/avatars/2d5aa9cdaeb049189930461fc9b91cc5?size=128) ![Notch's avatar](https://crafatar.com/avatars/069a79f444e94726a5befca90e38aaf5?size=128) ![sk89q's avatar](https://crafatar.com/avatars/0ea8eca3dbf647cc9d1ac64551ca975c?size=128) ![md_5's avatar](https://crafatar.com/avatars/af74a02d19cb445bb07f6866a861f783?size=128) ![redstone_sheep's avatar](https://crafatar.com/avatars/ae795aa86327408e92ab25c8a59f3ba1?size=128) ![Jake0oo0's avatar](https://crafatar.com/avatars/2d5aa9cdaeb049189930461fc9b91cc5?size=128) ![Notch's avatar](https://crafatar.com/avatars/069a79f444e94726a5befca90e38aaf5?size=128) ![sk89q's avatar](https://crafatar.com/avatars/0ea8eca3dbf647cc9d1ac64551ca975c?size=128) ![md_5's avatar](https://crafatar.com/avatars/af74a02d19cb445bb07f6866a861f783?size=128)
## Usage / Documentation ## Usage / Documentation
@ -19,6 +19,7 @@ You can [join us](https://webchat.esper.net/?channels=spongy) in #spongy on irc.
## Install ## Install
* Clone the repository * Clone the repository
* Install [node-canvas](https://github.com/Automattic/node-canvas/wiki#desktop) dependencies.
* `npm install` * `npm install`
* `redis-server` * `redis-server`
* `cp "modules/config.example.js" "modules/config.js"` * `cp "modules/config.example.js" "modules/config.js"`

View File

@ -1,21 +1,19 @@
var config = { var config = {
min_size: 1, // for avatars min_size: 1, // < 1 will (obviously) cause crash
max_size: 512, // for avatars; too big values might lead to slow response time or DoS max_size: 512, // too big values might lead to slow response time or DoS
default_size: 160, // for avatars; size to be used when no size given default_size: 160, // size to be used when no size given
local_cache_time: 1200, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response local_cache_time: 30, // seconds until we will check if the image changed. should be > 60 to prevent mojang 429 response
browser_cache_time: 3600, // seconds until browser will request image again browser_cache_time: 30, // seconds until browser will request image again
cleaning_interval: 3, // seconds interval: deleting images if disk size at limit http_timeout: 3000, // ms until connection to mojang is dropped
cleaning_limit: 900000000000, // minumum required available KB on disk to trigger cleaning cleaning_interval: 1800, // seconds interval: deleting images if disk size at limit
cleaning_amount: 50000, // amount of avatar (and their helm) files to clean cleaning_limit: 10240, // minumum required available KB on disk to trigger cleaning
http_timeout: 1000, // ms until connection to mojang is dropped cleaning_amount: 50000, // amount of avatar (and their helm) files to clean
faces_dir: 'skins/faces/', // directory where faces are kept. should have trailing '/' http_timeout: 1000, // ms until connection to mojang is dropped
helms_dir: 'skins/helms/', // directory where helms are kept. should have trailing '/' faces_dir: 'skins/faces/', // directory where faces are kept. should have trailing '/'
skins_dir: 'skins/skins/', // directory where skins are kept. should have trailing '/' helms_dir: 'skins/helms/', // directory where helms are kept. should have trailing '/'
renders_dir: 'skins/renders/', // Directory where rendered skins are kept. should have trailing '/' debug_enabled: true, // enables logging.debug
debug_enabled: true, // enables logging.debug default_scale: 6, // the scale of rendered avatars
min_scale: 1, // for renders maximum_sale: 10 // the maximum scale of rendered avatars
max_scale: 100, // for renders; too big values might lead to slow response time or DoS
default_scale: 6, // for renders; scale to be used when no scale given
}; };
module.exports = config; module.exports = config;

View File

@ -63,12 +63,42 @@ block content
| Replace | Replace
mark.green id mark.green id
| with a Mojang <b>UUID</b> or <b>username</b> to get the related skin. | with a Mojang <b>UUID</b> or <b>username</b> to get the related skin.
| You are redirected to the textures URL, or the default image is served.<br> | The user's skin will be returned, or the default image is served.<br>
| You can use the default parameter here as well. | You can use the default parameter here as well.
.code .code
| #{domain}/skins/ | #{domain}/skins/
mark.green id mark.green id
a(id="renders", class="anchor")
a(href="renders")
h3 3D Renders
p
| Crafatar also provides support for 3D renders of Minecraft skins.
| Replace
mark.green id
| with a Mojang <b>UUID</b> or <b>username</b> to get an render for the skin.
.code
| #{domain}/renders/head/
mark.green id
.code
| #{domain}/renders/body/
mark.green id
| The <b>default</b> parameter can also be used here. The scale factor will not be applied.
| Using the <b>helm</b> parameter is also allowed, which will be overlayed onto the head.
| The <b>head</b> render type will return only a render of the skin's head, while the
| <b>body</b> render will return a render of the entire skin.
a(id="#render-parameters", class="#render-anchor")
a(href="#render-parameters")
h3 Render Parameters
a(id="scale", class="anchor")
a(href="#scale")
h4 scale
p
| The scale factor of the image #{config.min_scale} - #{config.max_scale}.<br>
| Default is #{config.default_scale}. The actual size differs between the type of render.
a(id="http-headers", class="anchor") a(id="http-headers", class="anchor")
a(href="#http-headers") a(href="#http-headers")
h3 HTTP headers h3 HTTP headers
@ -126,7 +156,7 @@ block content
.code #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6 .code #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6
p Jeb's avatar, 64 × 64 p Jeb's avatar, 64 × 64
.code #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6?size=64 .code #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6?size=64
p Jeb's avatar, 64 × 64, with helm p Jeb's avatar, 64 × 64, with helmet
.code #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6?size=64&amp;helm .code #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6?size=64&amp;helm
p Jeb's avatar, or fall back to steve p Jeb's avatar, or fall back to steve
.code #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6?default=steve .code #{domain}/avatars/853c80ef3c3749fdaa49938b674adae6?default=steve
@ -138,6 +168,10 @@ block content
.code #{domain}/skins/853c80ef3c3749fdaa49938b674adae6 .code #{domain}/skins/853c80ef3c3749fdaa49938b674adae6
p Jeb's skin by username p Jeb's skin by username
.code #{domain}/skins/jeb_ .code #{domain}/skins/jeb_
p Render of Jeb's Head
.code #{domain}/renders/head/853c80ef3c3749fdaa49938b674adae6
p Render of Jeb's Body, with helmet, by username
.code #{domain}/renders/body/jeb_?helm
.col-md-2.center .col-md-2.center
.sideface.redstone_sheep(title="redstone_sheep") .sideface.redstone_sheep(title="redstone_sheep")
.sideface.Jake0oo0(title="Jake0oo0") .sideface.Jake0oo0(title="Jake0oo0")