public static string GetImageUrl(ImageRequestMode imageMode, ImageFieldData data, int contentId, string binaryPropertyName) { var imageUrl = string.Empty; switch (imageMode) { case ImageRequestMode.Reference: imageUrl = data.ImgRef.Path; break; case ImageRequestMode.BinaryData: if (contentId > 0) imageUrl = string.Format("/binaryhandler.ashx?nodeid={0}&propertyname={1}", contentId, binaryPropertyName); break; default: break; } return imageUrl; }
/* ============================================================================== Public methods */ public static string GetSizeUrlParams(ImageRequestMode imageMode, int width, int height) { string sizeStr = string.Empty; if (width != 0 && width != 0) { switch (imageMode) { case ImageRequestMode.BinaryData: sizeStr = string.Format("&width={0}&height={1}", width, height); break; case ImageRequestMode.Reference: sizeStr = string.Format("?dynamicThumbnail=1&width={0}&height={1}", width, height); break; default: break; } } return sizeStr; }