/** * ---- AWS ----------------------------------------------------------------------------------------------------------- */ public function uploadToAWS($filePath) { if (is_null($this->s3)) { $this->s3 = new \S3($this->getSetting('awsAccessKey'), $this->getSetting('awsSecretAccessKey')); $this->s3->setExceptions(true); } $file = $this->s3->inputFile($filePath); $headers = $this->getSetting('awsRequestHeaders'); if (!isset($headers['Cache-Control'])) { $headers['Cache-Control'] = 'max-age=' . $this->getSetting('awsCacheDuration') . ', must-revalidate'; } if (!$this->s3->putObject($file, $this->getSetting('awsBucket'), ImagerService::fixSlashes($this->getSetting('awsFolder') . '/' . str_replace($this->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); } }