HUB
Sign inSign up
ipx logo

pooya/ipx

By pooya

•Updated about 8 years ago

🖼 High performance, secure and easy to use image proxy based on Sharp and libvips.

Image
0

537

pooya/ipx repository overview

IPX Logo

Docker Pulls Docker Automated build Docker Build Status

High performance, secure and easy to use image proxy based on Sharp⁠ and libvips⁠.

✅ Fast and minimal as possible.
✅ Easy deployment.
✅ Configurable operations.
✅ Built-in secure cache with human readable entries and resistant against duplicates.
✅ Remote agnostic cache and input adapters.
✅ Smart and auto cache cleaning.
✅ Twelve factor friendly.
✅ Client libraries for URL generation.

⁠Clients

⁠API

/{format}/{operations}/{src}

Operations are separated by a colon , (Example: op1,op2) and their arguments separated using underscore _ (Example: s_200_300)

ََ‍‍Use _ value in place for {format} or {operations} to keep original values of source image.

Possible values for format: jpeg,webp or png.

⁠Examples

Just change format to webp and keep other things same as source:

http://cdn.example.com/webp/_/avatars/buffalo.png

Keep original format (png) and set width to 200:

http://cdn.example.com/_/w_200/avatars/buffalo.png

Resize to 200x300px using embed method and change format to jpg:

http://cdn.example.com/jpg/s_200_300,embed/avatars/buffalo.png

⁠Docker deployment

Latest docker image is automatically built under pooya/ipx⁠.

Quick start:

docker run \
  -it \
  --rm \
  --volume ./storage:/app/storage:ro \
  --volume ./cache:/app/cache \
  --port 3000:3000
  pooya/ipx

Using docker-compose:

  image: pooya/ipx
  volumes:
    - ./storage:/app/storage:ro
    - ./cache:/app/cache
  ports:
    - 3000:3000

⁠Operations

OperationArgumentsExampleDescription
swidth, heights_200_300Resize image.
wwidthw_200Change image with.
hheighth_200Change image height.
embed-embedPreserving aspect ratio, resize the image to the maximum width or height specified then embed on a background of the exact width and height specified.
max-maxPreserving aspect ratio, resize the image to be as large as possible while ensuring its dimensions are less than or equal to the width and height specified.
min-minPreserving aspect ratio, resize the image to be as small as possible while ensuring its dimensions are greater than or equal to the width and height specified.

⁠Config

Config can be customized using IPX_* environment variables or config/local.js file. Here are defaults:

  ipx: {
    input: {
      adapter: 'IPX_INPUT_ADAPTER', // Default: fs.js
      dir: 'IPX_INPUT_DIR' // Default: storage
    },
    cache: {
      adapter: 'IPX_CACHE_ADAPTER', // Default: fs.js
      dir: 'IPX_CACHE_DIR', // Default: cache
      cleanCron: 'IPX_CACHE_CLEAN_CRON', // Default: 0 0 3 * * * (every night at 3:00 AM)
      maxUnusedMinutes: 'IPX_CACHE_CLEAN_MINUTES' // Default: 24 * 60 (24 hours)
    }
  }

⁠License

MIT - Pooya Parsa

Tag summary

Content type

Image

Digest

Size

273.5 MB

Last updated

almost 9 years ago

docker pull pooya/ipx