pictor is simple image upload/convert/download server.
The name of pictor comes from Pictor, a constellation.
Local storages and traffic are expensive, especially in cloud environment.
There're many cheap and large cloud/remote storage services, most of them provide cheap and fast HTTP access.
ex. Amazon S3, FTP+HTTP Static Image Hosting Services...
pictor is designed for these environment.
pictor basically works as following:
- upload is accomplished by pictor. cloud/remote storage can do if possible.
- convert is accomplished by pictor.
- download is accomlished by cloud/remote storage. pictor can do if you want.
- all files are stored in cloud/remote storage. local storage can do if you want.
- all variant files(generated by pictor) could be deleted at any anytime. pictor will generate it on demand.
- install prerequisites
for mac osx:
for debian/ubuntu linux:
$ brew install graphicsmagick
or else see http://graphicsmagick.org$ apt-get install graphicsmagick
- download & install pictor
install with npm:
or get source from github:
$ npm install pictor
$ git clone git@github.com:iolo/pictor.git
- startup pictor server
start as standalone:
or startup with pm2
$ ./bin/pictor --host=0.0.0.0 --port=3001
$ npm install pm2 -g $ pm2 start -i 4 -n pictor ./bin/pictor -- --host=0.0.0.0 --port=3001
- test run in browser
$ open http://localhost:3001
- test run in console
TBD...
configuration files are located in config
directory for various environment.
you should specify the environment with PICTOR_ENV
or NODE_ENV
environment variable.
you could specify the absolute path to the configuration file with PICTOR_CONFIG
environment variable also.
for more details, see source code of default configuration.
- embedding pictor in other expressjs app
- custom storage
- custom converter
- TBW...
- to show debug logs
set DEBUG
environment variable to *
or pictor:*
and run pictor.
$ DEBUG='*' ./bin/pictor
see http://github.com/visionmedia/debug
-
external dependencies for converters
- convert/resize/thumbnail/rotate/crop/resizecrop/meta/exif/holder: graphicsmagick(or imagemagick))
- optimize jpeg: jpegtran (already included via jpegtran-bin nodejs module)
- optimize png: optipng (already included via optipng-bin nodejs moudle)
- optimize gif: gifsicle (already included via gifsicle nodejs module)
- ...
-
project directory structure
config/ --- configurations for each environment(server-side)
libs/ -- nodejs modules(server-side) --> jshint, doxx task
converter/ -- converters
storage/ -- storage providers
pictor.js -- the main module
...
routes/ -- expressjs modules(server-side) --> jshint, apidoc task
tests/
**/*_test.js -- nodeunit testcases(server-side) --> nodeunit task
**/*_test.html -- qunit testcases(client-side) --> qunit task
app/ -- source of static web resources(client-side) --> concat, uglify, copy, jade task
js/ -- javascript source(client-side) --> jshint task
...
build/
app/ --> build output of static web resources(client-side)
docs/
api/ --> generated documents of apidoc for routes/ --> apidoc task
dox/ --> generated documents of doxx for libs/ --> doxx task
...
app.js -- launcher without cluster(server-side)
bin/pictor -- launcher with cluster(server-side)
- to generate api documents from source
grunt apidoc
open build/app/docs/api/index.html
- to generate source code documents from source
grunt doxx
open build/app/docs/api/index.html
--
that's all folks...
may the source be with you...