/** * @inheritDoc BaseAssetSourceType::getLocalCopy() * * @param AssetFileModel $file * * @return mixed */ public function getLocalCopy(AssetFileModel $file) { $location = AssetsHelper::getTempFilePath($file->getExtension()); $this->_prepareForRequests(); $this->_googleCloud->getObject($this->getSettings()->bucket, $this->_getGCPath($file), $location); return $location; }
/** * Return the thumbnail extension for a file. * * @param AssetFileModel $file * * @return string */ private function _getThumbExtension(AssetFileModel $file) { // For non-web-safe formats we go with jpg. if (!in_array(mb_strtolower(IOHelper::getExtension($file->filename)), ImageHelper::getWebSafeFormats())) { if ($file->getExtension() == 'svg' && craft()->images->isImagick()) { return 'png'; } return 'jpg'; } else { return $file->getExtension(); } }
/** * @inheritDoc BaseAssetSourceType::getLocalCopy() * * @param AssetFileModel $file * * @return mixed */ public function getLocalCopy(AssetFileModel $file) { $location = AssetsHelper::getTempFilePath($file->getExtension()); IOHelper::copyFile($this->_getFileSystemPath($file), $location); clearstatcache(); return $location; }
/** * @inheritDoc BaseAssetSourceType::getLocalCopy() * * @param AssetFileModel $file * * @return mixed */ public function getLocalCopy(AssetFileModel $file) { $location = AssetsHelper::getTempFilePath($file->getExtension()); $this->_downloadFile($this->_getRackspacePath($file), $location); return $location; }
/** * Return the thumbnail extension for a file. * * @param AssetFileModel $file * * @return string */ private function _getThumbExtension(AssetFileModel $file) { // For non-web-safe formats we go with jpg. if (!in_array(IOHelper::getExtension($file->filename), ImageHelper::getWebSafeFormats())) { return 'jpg'; } else { return $file->getExtension(); } }