
Removing the need to push data to s3 also helps server response times, as the network performance can be wildly inconsistent. Google PageSpeed does not like 302 redirects. This greatly improves performance both on the server side and client side. Instead, use a CDN to cache the modified images.

Modified images are not sent back to s3 for storage. Inspired a lot by Gulp, image-resizer passes around an Image object between each of the streams that contains information about the request and the image data (either as a buffer or stream). The codebase takes advantage of node streams. There is a RubyGem of helpers (both Ruby and Javascript) to assist you in building the endpoints for your image-resizer instance. Image-resizer can also simply be added as a node_module to any project and the streams interfaces used standalone./test.js has a good example of how the app should work running behind Express. The money file is server.js which loads the express configuration and routes.

This will create a new directory structure including all the necessary files needed to run image-resizer. $ npm install -g tripviss/image-resizer gulp All responses are crafted with custom responses to maximise the facility of the CDN. It will then resize according to the requested dimensions, optimize according to file type and optionally filter the image. When a new image size is requested of image-resizer via the CDN, it will pull down the original image from the cloud. Out of the box it supports: S3, Facebook, Twitter, Youtube, Vimeo (and local file system in development mode). There is also a plugin architecture that allows you to add your own image sources. Overviewīuilding and deploying your own version of image-resizer is as easy as running the cli tool ( image-resizer new), setting your Heroku configs and firing it up!īased on Express.js image-resizer uses sharp under the hood to modify and optimise your images. The primary goal for this project was to abstract the need to set image dimensions during the upload and storage phase of images in a modern web application. It is Heroku ready, but can also be deployed easily to any cloud provider (has been used with success on AWS). WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.Image-resizer is a Node.js application that sits as a custom origin to your CDN and will resize/optimise images on-the-fly. Unless required by applicable law or agreed to in writing, softwareĭistributed under the License is distributed on an "AS IS" BASIS, You may not use this file except in compliance with the License. Licensed under the Apache License, Version 2.0 (the "License") pipe ( writableStream ) ContributingĬovers reporting bugs, requesting features and submitting code changes.


from ( '' ) const roundedCornerResizer = sharp ( ).
