All Projects → fhemberger → hapi-imagemin-proxy

fhemberger / hapi-imagemin-proxy

Licence: MIT License
Hapi proxy for serving optimized images

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to hapi-imagemin-proxy

create-optimize-images
♻️ Reusable, scalable, bash scripts to create and optimize images.
Stars: ✭ 39 (+30%)
Mutual labels:  image-optimization
auto-cloudinary
Super simple Cloudinary auto-upload implementation for WordPress.
Stars: ✭ 34 (+13.33%)
Mutual labels:  image-optimization
exiting
Safely shutdown http://hapijs.com servers.
Stars: ✭ 23 (-23.33%)
Mutual labels:  hapi
api.pokedextracker.com
API for pokedextracker.com
Stars: ✭ 38 (+26.67%)
Mutual labels:  hapi
hapi-auth-bearer-simple
Hapi authentication plugin for bearer token validation
Stars: ✭ 16 (-46.67%)
Mutual labels:  hapi
hapi-decorators
Decorators for HapiJS routes
Stars: ✭ 65 (+116.67%)
Mutual labels:  hapi
imagekit-javascript
Javascript SDK for using ImageKit.io
Stars: ✭ 43 (+43.33%)
Mutual labels:  image-optimization
paydash
Worker payments dashboard for MGNREGA
Stars: ✭ 44 (+46.67%)
Mutual labels:  hapi
hapi-moon
Hassle-free and production ready hapi.js Server boilerplate
Stars: ✭ 23 (-23.33%)
Mutual labels:  hapi
Crashlyzer
Crash viewer web application for displaying the crashes reported by rn-crash-reporter components from React Native mobile applications.
Stars: ✭ 59 (+96.67%)
Mutual labels:  hapi
imagekit-python
ImageKit.io Python SDK
Stars: ✭ 27 (-10%)
Mutual labels:  image-optimization
docker-imgproxy
🌐 An ultra fast, production-grade on-the-fly image processing web server. Designed for high throughput with Nginx caching. Powered by imgproxy.
Stars: ✭ 45 (+50%)
Mutual labels:  image-optimization
imagekit-angular
Angular SDK for ImageKit.io client side file upload and URL generation
Stars: ✭ 16 (-46.67%)
Mutual labels:  image-optimization
wily
Build Node.js APIs from the command line (Dead Project 😵)
Stars: ✭ 14 (-53.33%)
Mutual labels:  hapi
hapi-sequelizejs
A hapi.js plugin to connect with Sequelize ORM
Stars: ✭ 56 (+86.67%)
Mutual labels:  hapi
typesafe-hapi
Typechecking for HapiJS based on Joi schemas!
Stars: ✭ 21 (-30%)
Mutual labels:  hapi
steerage
Hapi server configuration and composition using confidence, topo, and shortstop.
Stars: ✭ 15 (-50%)
Mutual labels:  hapi
joi-to-typescript
Convert Joi Schemas to TypeScript interfaces
Stars: ✭ 73 (+143.33%)
Mutual labels:  hapi
web-generator
👑 Gulp based task runner which creates HTML output from Pug HTML templates
Stars: ✭ 13 (-56.67%)
Mutual labels:  image-optimization
hapi-sentry
A hapi plugin for request error logging to Sentry
Stars: ✭ 24 (-20%)
Mutual labels:  hapi

hapi-imagemin-proxy

Image optimization proxy written in Node.js using hapi.

Build Status Current Version

Allows you to resize an image and change image formats. Output is always optimized for the smallest file size.

  • http://localhost:5678/cat.gif,w100 - Resize to a width of 100px
  • http://localhost:5678/cat.gif,w100,h50 - Fit into 100px × 50px (keeping aspect ratio)
  • http://localhost:5678/find-peace.png,jpg - Convert PNG to JPG
  • http://localhost:5678/find-peace.png,w100,h50,jpg - All combined

Usage

Requires GraphicsMagick to be installed (e.g. on Mac OS X via Homebrew: brew install graphicsmagick).

npm install hapi-imagemin-proxy

Afterwards, include hapi-imagemin-proxy as plug-in into your existing Hapi project (a demo server can be found in /example):

const Hapi = require('hapi');
const server = new Hapi.Server();

server.register({
    plugin: require('hapi-imagemin-proxy'),
    options: {
        source: '/path/to/images',
        cache: {},
        imageCache: {
            engine: require('catbox-memory'),
            options: {
                expiresIn: 3600000
            }
        },
        plugins: [
            imageminGm.resize(),
            imageminGm.convert(),
            imageminJpegoptim({ progressive: true, max: 75 }),
            imageminPngquant(),
            imageminGifsicle({ optimizationLevel: 3 }),
            imageminSvgo()
        ]
        // ...
    }
}, function (err) {

    if (err) {
        return {
            console.error(err);
        }
    }
});

Options

  • source: Location of the images to be served. Can be either a local path or a URL (required).

  • wreck: When source is an URL, these request options are passed to Wreck.

  • cache: Sets Hapi's route.cache options

  • imagecache:

    • engine: Catbox caching engine. Must support binary data, e.g. catbox-s3. Default: require('catbox-memory')
    • options: Engine specific options (optional)
      • maxByteSize: only for catbox-memory, default: 104857600 (100MB)
      • expiresIn: Cache time-to-live in milliseconds, default: 3600000 (one hour)
  • plugins: Array of imagemin optimization plug-ins, defaults:

    imageminJpegoptim({ progressive: true, max: 75 }),
    imageminPngquant(),
    imageminGifsicle({ optimizationLevel: 3 }),
    imageminSvgo()
    

TODO

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].