Ejemplo n.º 1
0
        public Bitmap GetBitmap(string bid)
        {
            var annex = _fileService.DownloadOneFileByBid(bid, out Stream stream);

            if (annex == null)
            {
                var img = Image.FromFile(Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "avatars", "profile-pic.jpg"));
                return(new Bitmap(img));
            }
            return(new Bitmap(Image.FromStream(stream)));
        }
Ejemplo n.º 2
0
        public FileResult Photo(string fid)
        {
            if (fid.IsMissing())
            {
                return(File("~/Content/avatars/profile-pic.jpg", "image/png"));
            }
            FapAttachment attachment = _fapFileService.DownloadOneFileByBid(fid, out Stream stream);

            if (attachment == null || stream == null)
            {
                return(File("~/Content/avatars/profile-pic.jpg", "image/png"));
            }
            else
            {
                return(File(stream, attachment.FileType));
            }
        }