How to dynamically resize images in Sitecore?

I created a web service and got the image from the sitecore6.6 file. Now I want to dynamically change the width and height of the image so that I have a large image on the fly. There are almost 1000 images that require resizing. Any help ...

+5
source share
1 answer

You can use several query string parameters in the image URL so that Sitecore changes the image. The image must be a Sitecore Media element.

The following is a list of supported query string parameters:

  • w: Width in pixels
  • h: Height in pixels
  • mw: maximum width in pixels
  • mh: maximum height in pixels
  • la: Language (the default language is context)
  • vs: ( - )
  • db: ( )
  • bc: ( )
  • as: (as = 1)
  • sc: (sc =.25 = 25%)
  • thn: Thumbnail (thn = 1)
  • dmc: , , (dmc = 1)

, ,? as = 1 & w = 600, 600 .

, MediaUrlOptions mediaUrl:

var mediaOptions = new MediaUrlOptions {AllowStretch = true, Width = 600};
var mediaUrl = MediaManager.GetMediaUrl(mediaItem, mediaOptions);
+13

All Articles