src/Image.php
public function copySourceImage($hash, $destinationOrg, $overwrite = true, $sourceOrg = '')
    {
        try {
            $headers = ['Destination' => $destinationOrg];
            if (false === $overwrite) {
                $headers['Overwrite'] = 'F';
            }
            $response = $this->call('COPY',
                implode('/', [self::SOURCEIMAGE_RESOURCE, $this->getOrganizationName($sourceOrg), $hash]),
                ['headers' => $headers]
            );
        } catch (GuzzleException $e) {
            if (404 == $e->getCode()) {
                return false;
            }

            throw $e;
        }
        $statusCode = $response->getStatusCode();

        return  $statusCode >= 200 && $statusCode < 300;
    }
public function copySourceImage($hash, $destinationOrg, $overwrite = true, $sourceOrg = '')
    {
        try {
            $headers = ['Destination' => $destinationOrg];
            if (false === $overwrite) {
                $headers['Overwrite'] = 'F';
            }
            $response = $this->call('COPY',
                implode('/', [self::SOURCEIMAGE_RESOURCE, $this->getOrganizationName($sourceOrg), $hash]),
                ['headers' => $headers]
            );
        } catch (GuzzleException $e) {
            if (404 == $e->getCode()) {
                return false;
            }

            throw $e;
        }
        $statusCode = $response->getStatusCode();

        return  $statusCode >= 200 && $statusCode < 300;
    }
public function copySourceImage ( $ hash , $ destinationOrg , $ overwrite = true , $ sourceOrg = '' ) { try { $ headers = [ 'Destination' => $ destinationOrg ] ; if ( false === $ overwrite ) { $ headers [ 'Overwrite' ] = 'F' ; } $ response = $ this -> call ( 'COPY' , implode ( '/' , [ self :: SOURCEIMAGE_RESOURCE , $ this -> getOrganizationName ( $ sourceOrg ) , $ hash ] ) , [ 'headers' => $ headers ] ) ; } catch ( GuzzleException $ e ) { if ( 404 == $ e -> getCode ( ) ) { return false ; } throw $ e ; } $ statusCode = $ response -> getStatusCode ( ) ; return $ statusCode >= 200 && $ statusCode < 300 ; }
Copy a source image to another org.

Needs read permissions on the source organization and write permissions on the write organization.

@param string $hash           Hash of the image
@param string $destinationOrg The destination organization
@param bool   $overwrite      If an existing image should be overwritten
@param string $sourceOrg      Optional source organization name

@throws GuzzleException If the request fails for a different reason than image not found

@return bool True if successful, false if source image not found
Copy a source image to another org .