1

I'd like to host images for my website on Azure. The images should be compressed and available in different resolutions.

Of course, I could just compress and scale the images by myself and put them in a blob storage.

But is there a way to let Azure do the work for me? I want to upload an image in a very high resolution and Azure should create versions in different resolutions and compress them. After that the image should be published so that I can retrieve it from my website.

Is there a better way to host images than Azure blob storage?

Stimmler
  • 322
  • 4
  • 15
  • 1
    Yes, you can use the Azure function with blob trigger to do it, I have posted a solution here before: https://stackoverflow.com/questions/66251887/pil-unidentifiedimageerror-from-azure-blob-trigger-though-image-opens-in-watch/66253773#66253773 . let me know if you have any further questions. – Stanley Gong Feb 23 '21 at 09:28

1 Answers1

1

You can create an Event Subscription that will respond to the blob storage uploaded event, after that, an Azure Function will be triggered and will handle the event by creating a resized version of an image and copying it to a separate storage container. This is an auto-scale solution. An example that exactly describes your situation can be found on official microsoft docs page Tutorial: Automate resizing uploaded images using Event Grid.

Event Grid enables Azure Functions to respond to Azure Blob storage events and generate thumbnails of uploaded images. An event subscription is created against the Blob storage create event. When a blob is added to a specific Blob storage container, a function endpoint is called. Data passed to the function binding from Event Grid is used to access the blob and generate the thumbnail image.

Igor
  • 266
  • 1
  • 3
  • 13