public ActionResult PUpload() { Entity.blog_tb_Photo entity = new blog_tb_Photo(); entity.ID = Guid.NewGuid().ToString("N"); entity.AlbumID = Request["albumID"]; entity.UserID = UserInfo.UserID; Entity.blog_tb_Album album = Utility.AlbumBll.GetEntity(entity.AlbumID); ViewBag.AlbumName = album.Name; return(View("~/Views/" + Utility.Version + "/Photo/PUpload.cshtml", entity)); }
public ActionResult PhotoList() { string albumID = Request["albumID"]; PhotoListViewModel model = new PhotoListViewModel(); model.SiteID = BlogID; model.PhotoCollection = new List <Entity.blog_tb_Photo>(); Entity.blog_tb_Album album = Utility.AlbumBll.GetEntity(albumID); model.Title = album.Display + "-" + base.Info.blogTitle; List <blog_tb_Photo> list = Utility.PhotoBll.Query(albumID); //是否远程IP地址 2015-6-16 bool isRemote = Utility.IsRemote; foreach (var v in list) { Entity.blog_tb_Photo entity = new Entity.blog_tb_Photo(); entity.ID = v.ID; entity.Display = v.Display; if (String.IsNullOrEmpty(entity.Display)) { entity.Display = v.FileName; } string thumbUrl = v.ThumbUrl; if (isRemote) { thumbUrl = Utility.ReplaceImgOrFileSrc(thumbUrl); } string url = v.Url; if (isRemote) { url = Utility.ReplaceImgOrFileSrc(url); } entity.ThumbUrl = thumbUrl; if (String.IsNullOrEmpty(thumbUrl)) { entity.ThumbUrl = url; } model.PhotoCollection.Add(entity); } return(View("~/Views/Album/" + GetVersion() + "/PhotoList.cshtml", model)); }
public List <string> GetCoverPhotos(string albumID) { List <string> list = new List <string>(); Entity.blog_tb_Album entity = GetEntity(albumID); if (!String.IsNullOrEmpty(entity.CoverUrl)) { list.Add(entity.CoverUrl); } string sql = "select ThumbUrl from blog_tb_Photo where AlbumID=@AlbumID and ISNULL(ThumbUrl,'')<>'' order by ADD_DATE desc limit 0,6"; DataTable dt = DbInstance.GetDataTable(sql, DbInstance.CreateParameter("@AlbumID", albumID)); foreach (DataRow dr in dt.Rows) { if (!list.Contains(dr[0].ToString())) { list.Add(dr[0].ToString()); } } return(list); }
public ActionResult PhotoShow(string id) { string albumID = id; PhotoShowViewModel model = new PhotoShowViewModel(); model.SiteID = BlogID; model.PhotoCollection = new List <Entity.blog_tb_Photo>(); Entity.blog_tb_Album album = Utility.AlbumBll.GetEntity(albumID); model.Title = album.Display + "-" + base.Info.blogTitle; List <blog_tb_Photo> list = Utility.PhotoBll.Query(albumID); //是否远程IP地址 2015-6-16 bool isRemote = Utility.IsRemote; foreach (var v in list) { Entity.blog_tb_Photo entity = new Entity.blog_tb_Photo(); entity.ID = v.ID; entity.Display = v.Display; if (String.IsNullOrEmpty(entity.Display)) { entity.Display = v.FileName; } string thumbUrl = v.ThumbUrl; if (isRemote) { thumbUrl = Utility.ReplaceImgOrFileSrc(thumbUrl); } string url = v.Url; if (isRemote) { url = Utility.ReplaceImgOrFileSrc(url); } entity.ThumbUrl = thumbUrl; entity.Url = url; entity.Exif = "文件名:" + entity.Display + "<br/>" + v.Exif.Replace("\n", "<br/>"); model.PhotoCollection.Add(entity); } if (list.Count > 0) { string thumbUrl = list.First().ThumbUrl; if (isRemote) { thumbUrl = Utility.ReplaceImgOrFileSrc(thumbUrl); } string url = list.First().Url; if (isRemote) { url = Utility.ReplaceImgOrFileSrc(url); } model.CurrentThumbUrl = thumbUrl; model.CurrentUrl = url; } return(View("~/Views/Album/" + GetVersion() + "/PhotoShow.cshtml", model)); }