【发布时间】:2015-11-04 14:33:13
【问题描述】:
更新 2: 我仍在努力争取在服务器上保存图标。
我在做什么:
Item item = Sitecore.Context.Database.GetItem(imageId);
var imageIconUrl = Sitecore.Resources.Images.GetThemedImageSource(item.Appearance.Icon, ImageDimension.id32x32);
if (!string.IsNullOrEmpty(imageIconUrl))
{
// download the icon from the url
var iconFullPath = "e:\\pngIcons\\excelIcon.png";
var webClient = new System.Net.WebClient();
var downloadPath = "http://serverName/" + imageIconUrl;
webClient.DownloadFile(downloadPath, iconFullPath);
}
变量downloadPath 包含以下字符串:
http://serverName/sitecore/shell/themes/standard/~/media/E503BA48C89B422D8400393F1C7086A7.ashx?h=32&thn=1&w=32&db=master
最后我看到的是一个 png 文件,但里面什么都没有。我还复制了我在变量downloadPath 中得到的字符串并将其粘贴到浏览器中,我可以看到如下图标:
请让我知道我做错了什么。 或者如何保存图标。谢谢!!
原问题:
sitecore 媒体项目有一个字段“Media”。我说的是这个:
我想访问这个字段。原因是:
如果我使用例如访问它item.GetMediaStream() 然后我会得到完整的文件。我只是想在服务器上保存这个小图标。是否可以 ?
【问题讨论】:
标签: sitecore sitecore7.2