Cloudinary in front of Azure Blobs

Options
hacker
hacker Member Posts: 1
edited February 2023 in Developer APIs

Hello,

Is there a way that we can have Cloudinary serve up images that are stored in Azure Blob storage? Currently we're using the javascript Cloudinary plugin to go through all the images on our site and optimize them via a FETCH. We're looking into storing our images in Azure and wondering if it would still work the same or is there something else that has to be done?


Thanks,

Shawn

Tagged:

Answers

  • aleksandar
    aleksandar Member, Cloudinary Staff Posts: 14
    edited February 2023
    Options

    Hi @hacker ,

    Instead of the Fetch feature, I recommend you look into Auto-Upload (https://cloudinary.com/documentation/fetch_remote_images#auto_upload_remote_files).

    Similar to Fetch, it'll allow you to pull remote assets into Cloudinary but Auto-Upload allows them to be uploaded into Cloudinary rather than just cached and delivered. Assets auto-uploaded are treated the same way as assets you upload directly via the Media Library or API and can be managed the same way.

    Auto-Upload works by mapping a folder in your Cloudinary account to either a remote server URL, S3 or GCS bucket. For any request for delivery via Cloudinary that contains the mapped folder, Cloudinary will first check if the resource exists in your Cloudinary account. If it does, it will be served from there. If the requested resource is not in your Cloudinary account, then we will use the auto-upload mapping to attempt to retrieve the file from the remote location (server, S3 or GCS bucket). If the resource exists in the remote location then we will automatically upload it into your account and return it to the requester. If the resource also doesn't exist in the mapped location then a 404 is returned. The advantage of this approach is that assets can be uploaded 'lazily', in other words, only when needed/requested.

    You could map your Azure blob storage URL as part of Auto-Upload and then when you request images from Cloudinary we will automatically handle if that image needs to be uploaded into Cloudinary or if it can be served if it exists already. There is no need to explicitly upload the images to your cloud and you could just be uploading the assets to your Azure. Then on delivery, you would just need to build the URLs to your assets (based on the file path as stored on your Azure blob storage) and apply some transformations to your assets and Cloudinary will resolve the rest.