public WebImageMakerAdapter(WebImageMaker imaker, short type) { AltText = ""; if (!string.IsNullOrEmpty(imaker.ImageHeight)) { try { Height = Convert.ToInt16(imaker.ImageHeight); } catch { Height = 0; } } if (!string.IsNullOrEmpty(imaker.ImageWidth)) { try { Width = Convert.ToInt16(imaker.ImageWidth); } catch { Width = 0; } } if (imaker.WebImagePath != null) { if (type == (short)Cuyahoga.Modules.ECommerce.Util.Enums.ImageType.Large) { Url = WebHelper.GetLargeImageUrl(imaker.WebImagePath); } else { Url = WebHelper.GetImageUrl(imaker.WebImagePath); } } else { if (type == (short)Cuyahoga.Modules.ECommerce.Util.Enums.ImageType.Large) { Url = imaker.ImageUrl.Remove(0, WebHelper.GetLargeImagePathWeb().Length); } else { Url = imaker.ImageUrl.Remove(0, WebHelper.GetImagePathWeb().Length); } } ImageType = type; }
private WebImageMaker CreateImageMaker(string id, IImage image) { WebImageMaker wim = new WebImageMaker(); wim.ID = AdditionalImageCount.ToString(); wim.WorkingDirectory = WebHelper.GetImageWorkingDirectory(); wim.ConfirmButtonText = "Confirm"; wim.CancelButtonText = "Cancel"; wim.UploadButtonText = "Upload"; wim.HandlerPath = "~/WebImageMakerHandler.ashx"; wim.EnableViewState = true; wim.Quality = WebImageQuality.High; if (!string.IsNullOrEmpty(id)) { wim.ID = id; } if (image != null) { wim.ImageHeight = image.Height.ToString(); wim.ImageWidth = image.Width.ToString(); if (image.ImageType == (short)Cuyahoga.Modules.ECommerce.Util.Enums.ImageType.Large) { wim.ImageUrl = WebHelper.GetLargeImagePathWeb() + image.Url; } else { wim.ImageUrl = WebHelper.GetImagePathWeb() + image.Url; } wim.ImageHeight = (image.Height > 0) ? ImageHeight.ToString() : "*"; wim.ImageWidth = (image.Width > 0) ? ImageWidth.ToString() : "*"; } else { wim.ImageHeight = (ImageHeight > 0) ? ImageHeight.ToString() : "150"; wim.ImageWidth = (ImageWidth > 0) ? ImageWidth.ToString() : "*"; } return wim; }