Restful Image

Categories

Component ID

2342425

Component name

Restful Image

Component type

module

Maintenance status

Development status

Component security advisory coverage

not-covered

Component created

Component changed

Component body

This module try to build Drupal as Restful Image service.
Original images can be located at different web server or local server but different directories.

Module extensively uses file and image functions provided by Drupal.

Process

Module will download the image, process it based on request parameters (resize, rescale, rotate, change image quality, apply image style, etc.), and output it with correct HTTP headers. This process is on-the-fly and cacheable to improve response time for next request.

Example

Original Image Location
http://www.example.com/product/images/image.png
Drupal Restful Image location
$base_url/riapi/www.example.com/product/images/image.png
Defacto Image location
$base_url/sites/default/files/riapi/image.png
Alternate short location (www.example.com/product/images shorten as static)
$base_url/riapi/static/image.png
Or even shorter (experimental)
$base_url/static/image.png
Process Image (scale down based on width)
$base_url/riapi/static/image.png?w=200
Image Derivative (integration with thumbnail image style from image module)
$base_url/riapi/static/thumbnail/image.png

Scenarios

  • Image upload process already handled by other server which has no further processing capabilities (scaling, optimizing).
  • Unable using image service such as AWS S3, because the service is too expensive.
  • Shorten (a little) image URL.

Current problems

  • quality parameter (q) can not be used because q is used by Drupal.
  • to improve response time, server configuration is needed. (tested using nginx and apache)

Resources

Related Modules

  • Drupal Core Image Module: image style integration.
  • ImageAPI Optimize Module: further image optimization.

This module is still working on progress to fullfill Restful Image API specification.
Currently only implements scale down by width and jpeg quality image parameters.