Reputation: 461
I created a web service and had imagefield from the sitecore6.6. Now i am want to change the width and height of image dynamically so that i have big image on the fly. There are almost 1000 pictures which require size change . Any help...
Upvotes: 6
Views: 4794
Reputation: 4082
You can use several query string parameters in the url of the image to let Sitecore modify the image. The image has to be a Sitecore Media item.
Here is a list of the supported query string parameters:
In your case you can use for example the ?as=1&w=600 to get the image resized to 600px width.
You can also do this programmatically to set the MediaUrlOptions when creating the mediaUrl:
var mediaOptions = new MediaUrlOptions {AllowStretch = true, Width = 600};
var mediaUrl = MediaManager.GetMediaUrl(mediaItem, mediaOptions);
Upvotes: 14