getCdnService(); $thisCdnContainer = null; /** @var Container $cdnContainer */ foreach ($cdnService->listContainers() as $cdnContainer) { if ($cdnContainer->cdn_enabled && strtolower($cdnContainer->name) == strtolower($this->configuration->container_name)) { $isCdnEnabled = true; $thisCdnContainer = $cdnContainer; } } if ($isCdnEnabled) { return sprintf('%s/%s', $thisCdnContainer->cdn_ssl_uri, $this->getPathToPhoto($photo, $thumbnail)); } return parent::getPathToPhoto($photo, $thumbnail); } protected function getCdnService() { return $this->getClient()->objectStoreCdnV1(); } protected function getClient() { $authURL = config('services.rackspace.authentication_url'); // Uncomment the commented out lines below and in the $options array to get a 'storage/logs/openstack.log' file // with passed HTTP traffic //$logger = new Logger('MyLog'); //$logger->pushHandler(new StreamHandler(__DIR__ . '/../../storage/logs/openstack.log'), Logger::DEBUG); $options = [ 'authUrl' => $authURL, 'username' => $this->configuration->username, 'apiKey' => decrypt($this->configuration->password), 'region' => $this->configuration->service_region, 'identityService' => RackspaceIdentityV2Service::factory( new Client([ 'base_uri' => TransportUtils::normalizeUrl($authURL), 'handler' => HandlerStack::create(), ]) ), //'debugLog' => true, //'logger' => $logger, //'messageFormatter' => new MessageFormatter('{req_body} - {res_body}') ]; return new Rackspace($options); } protected function getStorageServiceCatalogName() { return 'cloudFiles'; } }