diff --git a/README.md b/README.md index 83484a9..6f341d8 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ A photo gallery site implemented in ASP.NET Core 2.0 Razor Pages. - Elegant masonry layout of images - Easy to manage through simple [admin interface](#admin-interface) - All major browsers fully supported (IE 10+) +- Social media integration (Facebook, Twitter, Pinterest) - Follows best practices for web applications - [See DareBoost report](art/dareboost-report.pdf) diff --git a/src/Pages/Album.cshtml.cs b/src/Pages/Album.cshtml.cs index e74f5ce..559e58c 100644 --- a/src/Pages/Album.cshtml.cs +++ b/src/Pages/Album.cshtml.cs @@ -79,21 +79,22 @@ public async Task OnPostUpload(string name, ICollection _ac.IsImageFile(f.FileName))) { - string path = Path.Combine(_environment.WebRootPath, "albums", album.Name, Path.GetFileName(file.FileName)); + string fileName = Path.GetFileName(file.FileName); + string filePath = Path.Combine(_environment.WebRootPath, "albums", album.Name, Path.GetFileName(fileName)); - if (System.IO.File.Exists(path)) + if (System.IO.File.Exists(filePath)) { - path = Path.ChangeExtension(path, file.GetHashCode() + Path.GetExtension(path)); + filePath = Path.ChangeExtension(filePath, file.GetHashCode() + Path.GetExtension(filePath)); } using (var imageStream = file.OpenReadStream()) - using (var fileStream = new FileStream(path, FileMode.Create, FileAccess.Write)) + using (var fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write)) { - _processor.CreateThumbnails(imageStream, path); + _processor.CreateThumbnails(imageStream, filePath); await file.CopyToAsync(fileStream); } - var photo = new Photo(album, new FileInfo(path)); + var photo = new Photo(album, new FileInfo(filePath)); album.Photos.Insert(0, photo); } diff --git a/src/Pages/_Layout.cshtml b/src/Pages/_Layout.cshtml index 913d84c..d0560ed 100644 --- a/src/Pages/_Layout.cshtml +++ b/src/Pages/_Layout.cshtml @@ -26,6 +26,7 @@
@RenderBody() + @{await Html.RenderPartialAsync("_SocialButtons.cshtml", ViewData["Title"]);}