Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing SVG file from Azure blob

Tags:

svg

blob

azure

I just came across a very strange problem:

<div class="logo-holder">
    <img class="sponsorhip-logo-preview" id="LogoPreview"         
        src="http://cdn.insights.bio/uploads/83cfc94c4a8c4f14b3cd050cd7e1c7aa.svg">
</div>

Using an SVG file as the source of the image results with broken image in chrome

This image is stored on azure CDN. I do not see any error in Chrome console.

Has anyone come across this problem?

like image 883
JamesP Avatar asked Oct 20 '25 01:10

JamesP


1 Answers

In the end, I've managed to figure out thank you to Markus.

During image upload to Azure blob, all files were uploaded with default content-type. This line of code made all the huge difference

 if (DoesBlobFileExist(blobName))
                blobName = RenameFile(blobName);
            CloudBlockBlob blob = container.GetBlockBlobReference(blobName);
            if (blobName.EndsWith(".svg"))
                blob.Properties.ContentType = "image/svg+xml";
like image 87
JamesP Avatar answered Oct 22 '25 04:10

JamesP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!