Reputation: 922
I'm trying to resize the image from blob storage using the Azure
function - the easy task, lots of samples, works great, but. works only when resized image is saved to a different file. My problem is that I would like to replace the original image with resized one - with the sane location and name.
when I set output blob to be the same as input blob, it is triggered over and over again without the finish.
is there any way I could change blob using azure function and store result in the same file?
Upvotes: 2
Views: 414
Reputation: 35154
The easiest option is to accept two invocations for the same file, but add a check of the size of the incoming file. If the size is already OK, do nothing and quit without changing the file again. This should break you out of the loop.
Blob trigger uses Storage Logs to watch for new or changed blobs. It then compares the changed blob against Blob Receipts in a container named azure-webjobs-hosts
in the Azure storage account. Each receipt has ETag
associated with it, so when you change a blob, the ETag
changes and the Blob is submitted to the function again.
Unless you want to go fancy and update ETag
's in receipts from within a function (not sure if it's feasible), your changed files will go for re-processing.
Upvotes: 2