Uploadcare provides the ability for users to upload files from any cloud storage provider. Uploadcare also provides other functionality such as cropping images.
For now we will use the storage of Uploadcare, this will probably change in the future. To protect the files we will use a custom CDN with signed URLs, you can read more about this in their knowledge base.
In the future we might want to use our own storage to store the attachments the user uploads with Uploadcare. Uploadcare would provide us with a temporary link (valid for 24 hours) to the file. You can read more about this in their documentation about storage.
If a user uploads an item with the Uploadcare widget we get back a response like:
{
"uuid": "e350b8f2-ba54-4dd9-8a73-e13ff54ff416",
"name": "icon.png",
"size": 15122,
"isStored": true,
"isImage": true,
"originalImageInfo": {
"orientation": null,
"format": "PNG",
"height": 128,
"width": 128,
"geo_location": null,
"datetime_original": null
},
"originalUrl": "https://ucarecdn.com/e350b8f2-ba54-4dd9-8a73-e13ff54ff416/",
"cdnUrl": "https://ucarecdn.com/e350b8f2-ba54-4dd9-8a73-e13ff54ff416/",
"cdnUrlModifiers": null,
"sourceInfo": {
"source": "local",
"file": {}
}
}What we will send to the API is:
{
"type":"item",
"owner":{
...
},
"description":"<p>Description</p>",
"labels":[
...
],
"privacy_level":"organization",
"attachments":[
{
"type":"image",
"url":"https://ucarecdn.com/826f978d-b9bd-4d7b-a516-3d60030c8dc9/",
"title":"icon.png",
"origin":"uploadcare"
},
{
"type":"file",
"url":"https://ucarecdn.com/4c11de43-fcf2-4bfc-8cf2-ec74c4a3b98d/",
"title":"Label A office info 010.pdf",
"origin":"uploadcare"
}
],
"draft":false
}The back-end will need to generate the thumbnails just like it does for normal uploads. Although the Uploadcare CDN API provides a way to transform images to your liking, you can read more about this in their documentation.
I push first version, take a look, is that what you expected?
I expected these types:
'type' => 'uploadcare',
'uploadcare_type' => ,