diff --git a/README.md b/README.md index 0c956f5..cc4870c 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ - Deals with any file formats (ncluding HEIC, HEVC) - Only updates changed files, runs incrementally - Uses relative paths (safe for using in subdirectory or S3) +- Minimal bloat (no third party frontend libraries, minimal CSS) *Please note that fastgallery is still pre-alpha, I am actively working on it* @@ -34,3 +35,8 @@ Then, for dependencies, install libvips42 for images and optionally ffmpeg (if y ## Roadmap For the prioritised roadmap, please see https://github.com/tonimelisma/fastgallery/projects/1 + +## Third party libraries +- (govips)[https://github.com/davidbyttow/govips], lightning fast image processing and resizing library +- (Feather)[https://github.com/feathericons/feather] icons, simple and beautiful +- (Primer)[https://github.com/primer/css] CSS, Github's in-house design system \ No newline at end of file diff --git a/cmd/fastgallery/main.go b/cmd/fastgallery/main.go index 0ef05f9..c4598ff 100644 --- a/cmd/fastgallery/main.go +++ b/cmd/fastgallery/main.go @@ -16,6 +16,9 @@ import ( "github.com/davidbyttow/govips/v2/vips" ) +// assets +const assetPlaybuttonImage = "/home/toni/go/src/github.com/tonimelisma/fastgallery/assets/playbutton.png" + // global defaults const optSymlinkDir = "_original" const optFullsizeDir = "_pictures" @@ -438,12 +441,30 @@ func resizeThumbnailVideo(source string, destination string) { ffmpegCommand.Stdout = os.Stdout ffmpegCommand.Stderr = os.Stderr - // TODO overlay triangle to thumbnail to implicate it's video instead of image - err := ffmpegCommand.Run() if err != nil { - fmt.Fprintf(os.Stderr, "Could create thumbnail of video %s", source) + fmt.Fprintf(os.Stderr, "Could not create thumbnail of video %s", source) } + + // Take thumbnail and overlay triangle image on top of it + + image, err := vips.NewImageFromFile(destination) + checkError(err) + + // TODO don't load overlay separately + playbuttonOverlayImage, err := vips.NewImageFromFile(assetPlaybuttonImage) + checkError(err) + + // overlay play button in the middle of thumbnail picture + err = image.Composite(playbuttonOverlayImage, vips.BlendModeSource, (thumbnailWidth/2)-(playbuttonOverlayImage.Width()/2), (thumbnailHeight/2)-(playbuttonOverlayImage.Height()/2)) + checkError(err) + + ep := vips.NewDefaultJPEGExportParams() + imageBytes, _, err := image.Export(ep) + checkError(err) + + err = ioutil.WriteFile(destination, imageBytes, optFileMode) + checkError(err) } func resizeFullsizeVideo(source string, destination string) { @@ -453,7 +474,7 @@ func resizeFullsizeVideo(source string, destination string) { err := ffmpegCommand.Run() if err != nil { - fmt.Fprintf(os.Stderr, "Could create full-size video of %s", source) + fmt.Fprintf(os.Stderr, "Could not create full-size video of %s", source) } } diff --git a/web/fastgallery.css b/web/fastgallery.css index 78e23ba..360f5f5 100644 --- a/web/fastgallery.css +++ b/web/fastgallery.css @@ -9,7 +9,7 @@ #modalHeader, #modalFooter { - width: 500px; + min-width: 300px; } .modalControl:hover, diff --git a/web/template.html b/web/template.html index 5765359..391851e 100644 --- a/web/template.html +++ b/web/template.html @@ -14,57 +14,81 @@
-
+
diipadaapa temp2
-
+
2018-03-31 16.48.28.jpg 2018-03-31 16.48.28.jpg
-
+
2018-03-31 16.48.28.jpg 2018-07-16 17.28.12 -000.jpg
-
+
2018-11-10 16.48.28.jpg 2018-07-16 17.28.12 -000.jpg
-
+
2016-05-01 18.20.21.jpg 2016-05-01 18.20.21
-
+
2018-03-31 16.48.28.jpg 2018-03-31 16.48.28.jpg
-
+
2018-03-31 16.48.28.jpg 2018-07-16 17.28.12 -000.jpg
-
+
2018-11-10 16.48.28.jpg 2018-07-16 17.28.12 -000.jpg
-
+
2016-05-01 18.20.21.jpg 2016-05-01 18.20.21
-
+
2018-03-31 16.48.28.jpg 2018-03-31 16.48.28.jpg
-
+
2018-03-31 16.48.28.jpg 2018-07-16 17.28.12 -000.jpg
-
+
2018-11-10 16.48.28.jpg 2018-07-16 17.28.12 -000.jpg
-
+
+ 2018-03-31 16.48.28.jpg + 2018-03-31 16.48.28.jpg +
+
+ 2018-03-31 16.48.28.jpg + 2018-07-16 17.28.12 -000.jpg +
+
+ 2018-11-10 16.48.28.jpg + 2018-07-16 17.28.12 -000.jpg +
+
+ 2018-03-31 16.48.28.jpg + 2018-03-31 16.48.28.jpg +
+
+ 2018-03-31 16.48.28.jpg + 2018-07-16 17.28.12 -000.jpg +
+
+ 2018-11-10 16.48.28.jpg + 2018-07-16 17.28.12 -000.jpg +
+
2016-05-01 18.20.21.jpg 2016-05-01 18.20.21
@@ -77,14 +101,14 @@ fix order of header icons, picture height -->