src/Image.php
public function getSourceImageUri($hash, $stack, $format = 'jpg', $name = null, $organization = null)
    {
        $apiUri = new Uri($this->client->getConfig('base_uri'));
        $format = strtolower($format);

        // Removing the 'api.' part (third domain level)
        $parts = explode('.', $apiUri->getHost(), 2);
        $baseHost = array_pop($parts);

        $path = UriHelper::composeUri(['stack' => $stack, 'hash' => $hash, 'format' => $format, 'filename' => $name]);
        // Building the URI as "{scheme}://{organization}.{baseHost}[:{port}]/{stackName}/{hash}[/{name}].{format}"
        $parts = [
            'scheme' => $apiUri->getScheme(),
            'port' => $apiUri->getPort(),
            'host' => $this->getOrganizationName($organization).'.'.$baseHost,
            'path' => $path->getPath(),
        ];

        return Uri::fromParts($parts);
    }
public function getSourceImageUri($hash, $stack, $format = 'jpg', $name = null, $organization = null)
    {
        $apiUri = new Uri($this->client->getConfig('base_uri'));
        $format = strtolower($format);

        // Removing the 'api.' part (third domain level)
        $parts = explode('.', $apiUri->getHost(), 2);
        $baseHost = array_pop($parts);

        $path = UriHelper::composeUri(['stack' => $stack, 'hash' => $hash, 'format' => $format, 'filename' => $name]);
        // Building the URI as "{scheme}://{organization}.{baseHost}[:{port}]/{stackName}/{hash}[/{name}].{format}"
        $parts = [
            'scheme' => $apiUri->getScheme(),
            'port' => $apiUri->getPort(),
            'host' => $this->getOrganizationName($organization).'.'.$baseHost,
            'path' => $path->getPath(),
        ];

        return Uri::fromParts($parts);
    }
public function getSourceImageUri ( $ hash , $ stack , $ format = 'jpg' , $ name = null , $ organization = null ) { $ apiUri = new Uri ( $ this -> client -> getConfig ( 'base_uri' ) ) ; $ format = strtolower ( $ format ) ; // Removing the 'api.' part (third domain level) $ parts = explode ( '.' , $ apiUri -> getHost ( ) , 2 ) ; $ baseHost = array_pop ( $ parts ) ; $ path = UriHelper :: composeUri ( [ 'stack' => $ stack , 'hash' => $ hash , 'format' => $ format , 'filename' => $ name ] ) ; // Building the URI as "{scheme}://{organization}.{baseHost}[:{port}]/{stackName}/{hash}[/{name}].{format}" $ parts = [ 'scheme' => $ apiUri -> getScheme ( ) , 'port' => $ apiUri -> getPort ( ) , 'host' => $ this -> getOrganizationName ( $ organization ) . '.' . $ baseHost , 'path' => $ path -> getPath ( ) , ] ; return Uri :: fromParts ( $ parts ) ; }
Returns url for accessing the image.

@param string          $hash         Identifier Hash
@param string|StackUri $stack        Stack to apply (name or StackUri object)
@param string          $format       Image format for output [jpg|png|gif]
@param string          $name         Optional image name for SEO purposes
@param string          $organization Optional organization name (if different from default in client)

@throws \RuntimeException

@return UriInterface
Returns url for accessing the image .