Developers and marketers use Cloudinary to quickly and easily create, manage and deliver their digital experiences across any browser, device and bandwidth.
Document: https://cloudinary.com/documentation/upload_images#uploading_with_a_direct_call_to_the_rest_api
Code example: https://github.com/barrystone/social_app/blob/main/frontend/src/components/UpdateProfile.tsx
Setting preset
API:
โโโโโโ https://api.cloudinary.com/v1_1/<your-cloud-id>/image/upload
Authenticated requests (protected)
Set default upload presets as
<sign-upload-preset-name-of-the-project-you-want-apply>
Only one project(signed upload preset) can be implement
https://cloudinary.com/documentation/upload_presets#default_upload_presets
Required parameters :
.env (variable needed)
signature and timestamp (nodejs-react-typescript-crypto)
โโโโโโโโโโ import Crypto from 'crypto';
โโโโโโโโโโ
โโโโโโโโโโ const timestamp = Math.round(Number(new Date()) / 1000);
โโโโโโโโโโ const signature = Crypto.createHash('sha256')
โโโโโโโโโโ .update(
โโโโโโโโโโ `eager=w_400,h_300,c_pad|w_260,h_200,c_crop&public_id=${public_id}×tamp=${timestamp}${process.env.REACT_APP_CLOUDINARY_API_SECRET}`
โโโโโโโโโโ )
โโโโโโโโโโ .digest('hex');
Unauthenticated requests (unprotected)
Can use different unsigned upload preset on multiple project for implement
Required parameters: