gcp_storage; if(!empty($value) && $value != '') { $fixed_data = preg_replace_callback ( '!s:(\d+):"(.*?)";!', function($match) { return ($match[1] == strlen($match[2])) ? $match[0] : 's:' . strlen($match[2]) . ':"' . $match[2] . '";'; }, $value ); $config = unserialize($fixed_data); } return $config; } } public static function getStorageConfig() { $config = self::getConfig(); if(isset($config['GOOGLE_CLOUD_PROJECT_ID'])){ $storage_config['driver'] = 'gcs'; $storage_config['project_id'] = $config['GOOGLE_CLOUD_PROJECT_ID']; $storage_config['bucket'] = $config['GOOGLE_CLOUD_STORAGE_BUCKET']; $storage_config['storage_api_uri'] = 'https://storage.googleapis.com'; $storage_config['key_file'] = json_decode($config['GOOGLE_CLOUD_AUTH_JSON_OBJECT'],true); return $storage_config; } else { return false; } } public static function getImageDirectoryPath() { $config = self::getConfig(); return $config['GOOGLE_CLOUD_DIRECTORY_IMAGE'] ?? 'images'; } public static function getVideoDirectoryPath() { $config = self::getConfig(); return $config['GOOGLE_CLOUD_DIRECTORY_VIDEO'] ?? 'videos'; } }