I'm looking to implement hashing on images that we are resizing manually in the cshtml file. I've looked at a few articles on how to do this and ended up with the following
<img class="callout-grid__image"
srcset="@Sitecore.Resources.Media.HashingUtils.ProtectAssetUrl(string.Format("{0}?w=300 1x", Model.GlassModel.CalloutImage.Src)),
@Sitecore.Resources.Media.HashingUtils.ProtectAssetUrl(string.Format("{0}?w=300 2x", Model.GlassModel.CalloutImage.Src))"
alt="@Model.GlassModel.CalloutImage.Alt">
This outputs the url with the hash in it but the image doesn't show. I get the error below in the console:
Failed parsing 'srcset' attribute value since it has an unknown descriptor.
The image url renders like this:
http://url/imagename.jpg?w=300 1x&hash=8628BA4B70220C694175BAD0EDA760C280B00BC4
I assume that the invalid attribute is the hash. Is there a way to have the hash on a srcset attribute?