Type to search...

Upload: remote

Upload from remote source. For example HTTP(S) URLs, Google Cloud Storage Objects, etc.

Request

HTTP request

HEAD /upload/v1/c/<cloudId>/remote HTTP/1.1

Parameters

Paramete name Value Description
Path parameters
cloudId string Cloud ID where you upload the image.
Optional query parameters
projection string Projection settings; comma separeted string see

Request Body

Property name Value Description Note
Required Properties
resource string Link of resource
publicId string Public Image ID to use with the image.
Optional Properties
transformation string Transformations on the image, affect the image before storing to the cloud
format string Image format to be stored
plugins string Plugins; comma separated string
tags string[] Tags for the image
allowOverride bool Allowing override of the image if public ID already exists

Response

If successful, this method returns a image resource in the response body.

Response HTTP status code

HTTP status code Description
200 Successfully uploaded
400 Bad request, for example bad transformation string
409 The public ID already exists
422 Unprocessable image, for example too small size of image
426 Failed dependency, for example download fail

For more information about HTTP codes, click here.

Rate limit

Detailed information for image rate limitation is available on Shardimage developers.

Limitations

  • Please consider that while downloading remote content, the connection’s maximum timout is 8 sec, the the download time cannot be more than 30 sec, including connection time as well.
  • Maximum number of allowed redirects while downloading remote content is 4.

SDK

use shardimage\shardimagephp\auth\Client;
use shardimage\shardimagephp\helpers\UploadHelper;
use shardimage\shardimagephp\factories\Transformation;
 
$client = new Client([
    'apiKey' => '<apiKey>',
    'apiSecret' => '<apiSecret>',
    'imageSecret' => '<imageSecret>',
]);
 
$params = [
    'resource' => "https://upload.wikimedia.org/wikipedia/commons/2/27/PHP-logo.svg",
    'cloudId' => '<cloudId>',
    'publicId' => '<publicId>',
    //'publicId' => UploadHelper::generateRandomPublicId(),  // or can be generated
];
$transformations = new Transformation();
$transformations->toJpeg();
$optParams = [      // Optional parameters
    'transformation' => $transformations
];
 
$response = $client->getUploadService()->uploadRemote($params, $optParams);
Table of contents