 Lynx = require 'lynx'
 Promise = require 'bluebird'
 easyimage = require 'easyimage'
+Compress = require '../compress'
 {CustomError} = require '../errors'
 fs = Promise.promisifyAll require('fs')
 

  ###*
   * @private
   *
   * Resizes and uploads a given image to the bucket
   * @param  {String} image The path the the image
   * @param  {String} prefix A prefix for the image key
   * @param  {Array} formats A list of formats for image resizing
   * @param  {String} [tmpDir] A path to a tmp folder
   * @return {Promise} A promise, fulfilled with the upload response or rejected with an error
  ###
  _resizeAndUploadImage: (image, prefix, formats, tmpDir = '/tmp') ->

    extension = path.extname image
    basename = path.basename image, extension

    , {concurrency: 2}

  ###*
   * Resizes, optionally compress and uploads a list of images to the bucket
   * Internally calls {@link _resizeCompressAndUploadImage}
   * @param  {Array} images A list of images to be processed
   * @param  {Object} description A config JSON object describing the images conversion
   * @param  {String} [tmpDir] A path to a tmp folder
   * @return {Promise} A promise, fulfilled with a successful response or rejected with an error
  ###
  resizeCompressAndUploadImages: (images, description, tmpDir = '/tmp', minify) ->

    Promise.map images, (image) =>
      name = path.basename(image.Key)
