diff --git a/products/images/src/content/cloudflare-images/upload-images/direct-creator-upload.md b/products/images/src/content/cloudflare-images/upload-images/direct-creator-upload.md index 01ee37d2848a03c..c1b5bb2c778382b 100644 --- a/products/images/src/content/cloudflare-images/upload-images/direct-creator-upload.md +++ b/products/images/src/content/cloudflare-images/upload-images/direct-creator-upload.md @@ -11,9 +11,10 @@ To request a one-time upload URL, simply have your back-end (or Worker script) c ```bash curl --request POST \ - --url https://api.cloudflare.com/client/v4/accounts//images/v1/direct_upload \ - --header 'Content-Type: application/json' \ - --header 'Authorization: Bearer :token' + --url https://api.cloudflare.com/client/v4/accounts//images/v2/direct_upload \ + --header 'Authorization: Bearer :token' \ + --form 'requireSignedURLs=true' \ + --form 'metadata={"key":"value"}' ``` You will receive a response similar to this: @@ -21,8 +22,8 @@ You will receive a response similar to this: ```json { "result": { - "id": "2cdc28f0-017a-49c4-9ed7-87056c839c2", - "uploadURL": "https://upload.imagedelivery.net/2cdc28f0-017a-49c4-9ed7-87056c839c2" + "id": "2cdc28f0-017a-49c4-9ed7-87056c83901", + "uploadURL": "https://upload.imagedelivery.net/2cdc28f0-017a-49c4-9ed7-87056c83901" }, "result_info": null, "success": true, @@ -31,29 +32,70 @@ You will receive a response similar to this: } ``` -Your back-end endpoint should return the `uploadURL` property to the client enabling it to upload the image without needing to pass any authentication information with it. Here is a simple HTML page that takes a one-time upload URL and uploads any selected image: +In the example above, `id` is a future image identifier that will be uploaded by a creator. + + + +With version 2 of `direct_upload`, a new draft image record is created when you invoke this endpoint. It will not appear on a [list of images](https://api.cloudflare.com/#cloudflare-images-list-images ), but it is possible to fetch an image record with the provided ID to check its current status: + +```bash +curl --url https://api.cloudflare.com/client/v4/accounts//images/v1/2cdc28f0-017a-49c4-9ed7-87056c83901 \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Bearer :token' +``` + +You will receive a response similar to this: + +```json +{ + "result": { + "id": "2cdc28f0-017a-49c4-9ed7-87056c83901", + "metadata": { + "key": "value": + }, + "uploaded": "2022-01-31T16:39:28.458Z", + "requiredSignedURLs": true, + "variants": [ + "https://imagedelivery.net/Vi7wi5KSItxGFsWRG2Us6Q/2cdc28f0-017a-49c4-9ed7-87056c83901/public", + "https://imagedelivery.net/Vi7wi5KSItxGFsWRG2Us6Q/2cdc28f0-017a-49c4-9ed7-87056c83901/thumbnail" + ], + "draft": true + }, + "success": true, + "errors": [], + "messages": [] +} +``` + +Once the image data is uploaded, the `draft` property will change to `false` and will not be part of the response anymore. + +Your back-end endpoint should return the `uploadURL` property to the client, enabling it to upload the image without needing to pass any authentication information with it. Here is an example of a simple HTML page that takes a one-time upload URL and uploads any image the user selects: ```html - -
- - -
- + +
+ + +
+ ``` By default, the `uploadURL` will expire after 30 minutes if unused. -If you want to override this option, add the following argument to the cURL command: +To override this option, add the following argument to the cURL command: ```bash - --data '{"expiry":"2021-09-14T16:00:00Z"}' +--data '{"expiry":"2021-09-14T16:00:00Z"}' ``` The expiry value must be a minimum of two minutes and maximum of six hours in the future. \ No newline at end of file diff --git a/products/images/src/content/faq.md b/products/images/src/content/faq.md index cf2c4f16470b71c..9e655abd8392470 100644 --- a/products/images/src/content/faq.md +++ b/products/images/src/content/faq.md @@ -100,6 +100,10 @@ Yes. Based on the `Accept` HTTP request header Cloudflare Images will be served Refer to our [Plans](https://www.cloudflare.com/plans/) page for up-to-date information on pricing. +### Is there a limit on image size or file size for Image Resizing? + +Yes. Maximum image size is 100 megapixels (for example, 10,000×10,000 pixels large). Maximum file size is 70 MB. GIF animations are limited to 100 megapixels total (sum of sizes of all frames). + ### Resizing failed and I received an error response with a code. What does it mean? Refer to [Troubleshoot Image Resizing problems](https://support.cloudflare.com/hc/articles/4412024022029) for more information on how to troubleshoot some of the more common issues, including error responses.