Apparently starting with Sitecore 7.5, Sitecore has made it so that parameters for image resizing require a hash in order to work. To programatically generate a url with the hash, the following code can be used:
Sitecore.Resources.Media.HashingUtils.ProtectAssetUrl(
Sitecore.Resources.Media.MediaManager.GetMediaUrl(
myMediaItem,
new MediaUrlOptions()
{
Language = Context.Language,
Width = 100,
Height = 75
}))
If you only need the hash value for the provided image URL, you could use the GetAssertUrlHash(url).
For more details please see this blog entry here: http://kirkegaard-at.blogspot.sg/2015/06/media-hash-and-resizing.html
For more on MediaUrlOptions: https://community.sitecore.net/developers/f/8/t/1654
Thursday, June 22, 2017
Friday, June 16, 2017
Sitecore Image Parameters
Here's a great reference for image parameters. Some include those for resizing images.
https://sdn.sitecore.net/Articles/XSL/5%203%20Enhancements/Image%20Enhancements.aspx
https://sdn.sitecore.net/Articles/XSL/5%203%20Enhancements/Image%20Enhancements.aspx
Subscribe to:
Posts (Atom)