在picture library中取某一图片的大图、小图

public static string GetPicThumbnail(SPFile file, string type)
{
    string thumbnail = "";

    string folderUrl = file.ParentFolder.ServerRelativeUrl;
    string fileName = file.Name;
    int expIndex = fileName.LastIndexOf('.');
    string subName = fileName.Substring(0, expIndex) + "_" + fileName.Substring(expIndex + 1) + ".jpg";

    if (type == "small")
    {
        thumbnail = folderUrl + "/_t/" + subName;//这是拿小图的;
    }
    else if (type == "big")
    {
        thumbnail = folderUrl + "/_w/" + subName;//这是拿大图的;
    }

    return thumbnail;
}

posted on 2013-12-14 17:23  木子叶  阅读(215)  评论(0编辑  收藏  举报

导航