/**
  * Upload file to AWS
  * 
  * @param $filePath
  */
 public function uploadToAWS($filePath)
 {
     $s3 = $this->_getS3Object();
     $file = $s3->inputFile($filePath);
     $headers = craft()->imager->getSetting('awsRequestHeaders');
     if (!isset($headers['Cache-Control'])) {
         $headers['Cache-Control'] = 'max-age=' . craft()->imager->getSetting('awsCacheDuration') . ', must-revalidate';
     }
     if (!$s3->putObject($file, craft()->imager->getSetting('awsBucket'), ImagerService::fixSlashes(craft()->imager->getSetting('awsFolder') . '/' . str_replace(craft()->imager->getSetting('imagerSystemPath'), '', $filePath), true, true), \S3::ACL_PUBLIC_READ, array(), $headers, $this->_getAWSStorageClass())) {
         ImagerPlugin::log("Upload to AWS failed for {$filePath} in ImagerService", LogLevel::Error);
     }
 }
 /**
  * @inheritDoc ITask::runStep()
  *
  * @param int $step
  *
  * @return bool
  */
 public function runStep($step)
 {
     if (is_array($this->_paths)) {
         $path = $this->_paths[$step];
     } else {
         $path = $this->_paths;
     }
     // Run TinyPNG
     craft()->imager->runJpegtran($path);
     // if AWS is enabled, upload file
     if (craft()->imager->getSetting('awsEnabled')) {
         try {
             craft()->imager->uploadToAWS($path);
         } catch (\Exception $e) {
             ImagerPlugin::log("Upload to AWS failed for {$path} in Imager_JpegtranTask", LogLevel::Error);
         }
     }
     return true;
 }