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 envionment.
There're many cheap and large cloud/remote storages 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:
brew install graphicsmagick
for debian/ubuntu linux:
apt-get install graphicsmagick
or else see http://graphicsmagick.org
-
get source from github:
git clone git@github.com:iolo/pictor.git
or install with npm:
npm install pictor
-
startup pictor server
node app.js
or startup with cluster:
./bin/pictor
-
test run in browser
open http://localhost:3001
-
test run in console
TBD...
configuration files are separated for each envionment(NODE_ENV
environment variable) in config
directory.
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.
see http://github.com/visionmedia/debug
-
external dependencies for converters
- convert/resize/thumbnail/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...