diff --git a/data/gallery/DSC00003.jpg b/data/gallery/DSC00003.jpg new file mode 100644 index 0000000..2067cd8 --- /dev/null +++ b/data/gallery/DSC00003.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e68efc4efb3693ed3f3b33d440612ea0c83e686b6e853acad940d089832c19d4 +size 2274940 diff --git a/data/gallery/DSC00015.jpg b/data/gallery/DSC00015.jpg new file mode 100644 index 0000000..a4784fe --- /dev/null +++ b/data/gallery/DSC00015.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0da9ec892321321a2299b77cdad8154da438b4aeb61e2b232ee9cf5516977195 +size 3568958 diff --git a/data/gallery/DSC00159-2.jpg b/data/gallery/DSC00159-2.jpg new file mode 100644 index 0000000..0bc77c8 --- /dev/null +++ b/data/gallery/DSC00159-2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e965f8d5eb3d3947d5ebbcccff64973cc61a613cb68b88957627702e83fbbec4 +size 1647472 diff --git a/data/gallery/DSC01832.jpg b/data/gallery/DSC01832.jpg new file mode 100644 index 0000000..63e1647 --- /dev/null +++ b/data/gallery/DSC01832.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:03a9732bd22b3e5543fa81818b5d84b16730859055519d2b38b34ba44253f60d +size 3058584 diff --git a/data/gallery/DSC02538-2.jpg b/data/gallery/DSC02538-2.jpg new file mode 100644 index 0000000..d87408c --- /dev/null +++ b/data/gallery/DSC02538-2.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbf0ac848392757a4c9b35d078300f3b88a2b552c04a5dae5e2c3dc9d836246c +size 220391 diff --git a/data/gallery/DSC03049.jpg b/data/gallery/DSC03049.jpg deleted file mode 100644 index 3793353..0000000 --- a/data/gallery/DSC03049.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d9a081a2091f928a69e76180882e098717f6e4ab9f8828b56c89f012503d9f47 -size 4862946 diff --git a/data/gallery/DSC03401.jpg b/data/gallery/DSC03401.jpg new file mode 100644 index 0000000..fe129c5 --- /dev/null +++ b/data/gallery/DSC03401.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e9a764ce68dac5b9f3100aba07493c897d55ab888a4e6603f67c78c94de6e49 +size 4606535 diff --git a/data/gallery/DSC06515.jpg b/data/gallery/DSC06515.jpg index 756826a..27a25ad 100644 --- a/data/gallery/DSC06515.jpg +++ b/data/gallery/DSC06515.jpg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:cb2b03593400b3c98f2ae5a87990e55f556df793677cd9d9ae281e8c752cb7c8 -size 9458141 +oid sha256:32cc5a0b7322df42f486270abd94249f8bdbe4547bf197abbdca28b1ac8a742f +size 9459988 diff --git a/data/gallery/DSC06719.jpg b/data/gallery/DSC06719.jpg new file mode 100644 index 0000000..e328855 --- /dev/null +++ b/data/gallery/DSC06719.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe0e1d627c62e974ce83549dd576b4bf35a08361709f020480724a69e2b9931f +size 4551505 diff --git a/data/gallery/DSC06803.jpg b/data/gallery/DSC06803.jpg new file mode 100644 index 0000000..34561b1 --- /dev/null +++ b/data/gallery/DSC06803.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8c722de9d907e690f570ebba949fffafb58e5b9cff9b5f99b4c432eb97d72fa +size 3362829 diff --git a/data/gallery/DSC08086.jpg b/data/gallery/DSC08086.jpg new file mode 100644 index 0000000..e949fb8 --- /dev/null +++ b/data/gallery/DSC08086.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1a751986e51f5eac227ee00ae8962c70fefcc324e307d9cf496ef8292d2e1ea5 +size 2011209 diff --git a/data/gallery/DSC08103.jpg b/data/gallery/DSC08103.jpg new file mode 100644 index 0000000..4d34969 --- /dev/null +++ b/data/gallery/DSC08103.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:46bca7a81f671b62e05a76149e4ef33ff647855408acf50222ffb9b431aa6a9f +size 4824394 diff --git a/data/gallery/DSC08222.jpg b/data/gallery/DSC08222.jpg new file mode 100644 index 0000000..007844a --- /dev/null +++ b/data/gallery/DSC08222.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b70c96565ca1d4f15425efd767136845441dbf79628938b17a4bb41a8e905556 +size 3752506 diff --git a/data/gallery/DSC08263.jpg b/data/gallery/DSC08263.jpg new file mode 100644 index 0000000..89e11d5 --- /dev/null +++ b/data/gallery/DSC08263.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2500a823af382c96b5eb35312869c2c13664f1127f736e7922dacf52f6a4aded +size 2789643 diff --git a/data/gallery/DSC08588.jpg b/data/gallery/DSC08588.jpg index 2b52dd3..3714615 100644 --- a/data/gallery/DSC08588.jpg +++ b/data/gallery/DSC08588.jpg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d8f90560094c1a739f55734f17c16ac568b761f963af732922ed4b9fac6a662c -size 3241886 +oid sha256:28b74680b1771eaa29a55f1eb040092c747bee4a3af6bf740143dadac7f9d103 +size 3243616 diff --git a/data/gallery/DSC09447.jpg b/data/gallery/DSC09447.jpg new file mode 100644 index 0000000..8df8ffb --- /dev/null +++ b/data/gallery/DSC09447.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d57c00d03a589a3d831f31699ebd6f4682eb62cd5a9b03dd7a744199d8bc26ce +size 2802651 diff --git a/data/gallery/DSC09453.jpg b/data/gallery/DSC09453.jpg index bd53995..4fa5a84 100644 --- a/data/gallery/DSC09453.jpg +++ b/data/gallery/DSC09453.jpg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f0836f0bcd784fd07c34c138cf6cd9ad45bf7e80f8e2853871566f08d63d75f3 -size 3426030 +oid sha256:ca12f243d17cf0a2c4c092150d636fb0ee06a382e5d80eafca160b82aaea5ed6 +size 3428106 diff --git a/data/gallery/DSC09454.jpg b/data/gallery/DSC09454.jpg new file mode 100644 index 0000000..0fc1bbd --- /dev/null +++ b/data/gallery/DSC09454.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c3b9c5d41cfbe9cee0bdf3c9280755d9520cb6b1fbef0dc44e3a66b621f72be8 +size 2235785 diff --git a/gatsby-node.ts b/gatsby-node.ts index 22eeae8..67a670d 100644 --- a/gatsby-node.ts +++ b/gatsby-node.ts @@ -10,6 +10,10 @@ import sharp from "sharp"; import { Palette } from "node-vibrant/lib/color"; import { performance } from "perf_hooks"; +import util from "node:util"; +import { exec as _exec } from "child_process"; +const exec = util.promisify(_exec); + // const path = require("path"); // const Vibrant = require("node-vibrant"); // const chroma = require("chroma-js"); @@ -114,7 +118,8 @@ function transformMetaToNodeData( metaData: Record, vibrantData: Palette, imagePath: string, - { r, g, b }: { r: number; b: number; g: number } + { r, g, b }: { r: number; b: number; g: number }, + datePublished: string ) { const vibrant = vibrantData ? processColors(vibrantData, imagePath) : null; const vibrantHue = vibrantData.Vibrant!.getHsl()[0] * 360; @@ -131,6 +136,7 @@ function transformMetaToNodeData( } return { dateTaken: metaData.DateTimeOriginal, + datePublished, meta: { Make: metaData.Make, Model: metaData.Model, @@ -139,6 +145,7 @@ function transformMetaToNodeData( ISO: metaData.ISO, DateTimeOriginal: metaData.DateTimeOriginal, CreateDate: metaData.CreateDate, + ModifyDate: metaData.ModifyDate, ShutterSpeedValue: metaData.ShutterSpeedValue, ApertureValue: metaData.ApertureValue, FocalLength: metaData.FocalLength, @@ -173,13 +180,34 @@ export const onCreateNode: GatsbyNode["onCreateNode"] = async function ({ const { createNodeField } = actions; if (node.internal.type === "File" && node.sourceInstanceName === "gallery") { - const metaData = await exifr.parse(node.absolutePath as string, { - iptc: true, - xmp: true, - // icc: true - }); + const { stdout: datePublished, stderr } = await exec( + `git log --diff-filter=A --follow --format=%aI -1 -- ${node.absolutePath}` + ); - const sharpImage = sharp(node.absolutePath as string); + if (stderr.length) { + console.error("something went wrong checking publish date: ", stderr); + } + + let metaData; + try { + metaData = await exifr.parse(node.absolutePath as string, { + iptc: true, + xmp: true, + // icc: true + }); + } catch (e) { + console.error(`something wen wrong with exifr on image ${node.base}`, e); + throw e; + } + + let sharpImage: sharp.Sharp; + + try { + sharpImage = sharp(node.absolutePath as string); + } catch (e) { + console.error(`something wen wrong with sharp on image ${node.base}`, e); + throw e; + } const { dominant } = await sharpImage.stats(); const resizedImage = await sharpImage .resize({ @@ -200,7 +228,9 @@ export const onCreateNode: GatsbyNode["onCreateNode"] = async function ({ metaData, vibrantData, node.absolutePath as string, - dominant + dominant, + // if datePublished is empty, image has not been committed to git yet and is thus brand new + datePublished.length ? datePublished.replace("\n", "") : new Date().toISOString() ), }); } diff --git a/scratchpad.js b/scratchpad.js new file mode 100644 index 0000000..b60d075 --- /dev/null +++ b/scratchpad.js @@ -0,0 +1,193 @@ +a = { + ApplicationRecordVersion: '\x00\x04', + DateCreated: '2015-10-18T17:59:38', + TimeCreated: '175938', + DigitalCreationDate: '20151018', + DigitalCreationTime: '175938', + format: 'image/jpeg', + CreatorTool: 'Adobe Lightroom 5.4 (Macintosh)', + ModifyDate: '2022-07-09T21:16:39.000Z', + CreateDate: '2015-10-19T00:59:38.000Z', + MetadataDate: '2022-07-09T14:16:39-07:00', + Rating: 5, + LensInfo: [ 50, 50, 1.8, 1.8 ], + Lens: 'DT 50mm F1.8 SAM', + DocumentID: 'xmp.did:27795bf1-8bb2-49a0-807a-cf6150bd505b', + OriginalDocumentID: 'CE2B8F240393ADFDF9F092CF395C6632', + InstanceID: 'xmp.iid:27795bf1-8bb2-49a0-807a-cf6150bd505b', + History: [ + { action: 'derived', parameters: 'saved to new location' }, + { + action: 'saved', + instanceID: 'xmp.iid:27795bf1-8bb2-49a0-807a-cf6150bd505b', + when: '2022-07-09T14:16:39-07:00', + softwareAgent: 'Adobe Lightroom 5.4 (Macintosh)', + changed: '/' + } + ], + DerivedFrom: { + documentID: 'CE2B8F240393ADFDF9F092CF395C6632', + originalDocumentID: 'CE2B8F240393ADFDF9F092CF395C6632' + }, + good: true, + Version: 14.4, + ProcessVersion: 6.7, + WhiteBalance: 'Manual', + IncrementalTemperature: -11, + IncrementalTint: 23, + Exposure2012: 0, + Contrast2012: 6, + Highlights2012: 0, + Shadows2012: 0, + Whites2012: 35, + Blacks2012: -22, + Texture: 0, + Clarity2012: 0, + Dehaze: 0, + Vibrance: 0, + Saturation: 'Normal', + ParametricShadows: 0, + ParametricDarks: 0, + ParametricLights: 0, + ParametricHighlights: 0, + ParametricShadowSplit: 25, + ParametricMidtoneSplit: 50, + ParametricHighlightSplit: 75, + Sharpness: 'Normal', + LuminanceSmoothing: 0, + ColorNoiseReduction: 0, + HueAdjustmentRed: 0, + HueAdjustmentOrange: 0, + HueAdjustmentYellow: 0, + HueAdjustmentGreen: 0, + HueAdjustmentAqua: 0, + HueAdjustmentBlue: 0, + HueAdjustmentPurple: 0, + HueAdjustmentMagenta: 0, + SaturationAdjustmentRed: 0, + SaturationAdjustmentOrange: 0, + SaturationAdjustmentYellow: 0, + SaturationAdjustmentGreen: 0, + SaturationAdjustmentAqua: 0, + SaturationAdjustmentBlue: 0, + SaturationAdjustmentPurple: 0, + SaturationAdjustmentMagenta: 0, + LuminanceAdjustmentRed: 0, + LuminanceAdjustmentOrange: 0, + LuminanceAdjustmentYellow: 0, + LuminanceAdjustmentGreen: 0, + LuminanceAdjustmentAqua: 0, + LuminanceAdjustmentBlue: 0, + LuminanceAdjustmentPurple: 0, + LuminanceAdjustmentMagenta: 0, + SplitToningShadowHue: 0, + SplitToningShadowSaturation: 0, + SplitToningHighlightHue: 0, + SplitToningHighlightSaturation: 0, + SplitToningBalance: 0, + ColorGradeMidtoneHue: 0, + ColorGradeMidtoneSat: 0, + ColorGradeShadowLum: 0, + ColorGradeMidtoneLum: 0, + ColorGradeHighlightLum: 0, + ColorGradeBlending: 50, + ColorGradeGlobalHue: 0, + ColorGradeGlobalSat: 0, + ColorGradeGlobalLum: 0, + AutoLateralCA: 0, + LensProfileEnable: 0, + LensManualDistortionAmount: 0, + VignetteAmount: 0, + DefringePurpleAmount: 0, + DefringePurpleHueLo: 30, + DefringePurpleHueHi: 70, + DefringeGreenAmount: 0, + DefringeGreenHueLo: 40, + DefringeGreenHueHi: 60, + PerspectiveUpright: 0, + PerspectiveVertical: 0, + PerspectiveHorizontal: 0, + PerspectiveRotate: 0, + PerspectiveAspect: 0, + PerspectiveScale: 100, + PerspectiveX: 0, + PerspectiveY: 0, + GrainAmount: 0, + PostCropVignetteAmount: 0, + ShadowTint: 0, + RedHue: 0, + RedSaturation: 0, + GreenHue: 0, + GreenSaturation: 0, + BlueHue: 0, + BlueSaturation: 0, + ConvertToGrayscale: false, + OverrideLookVignette: false, + ToneCurveName2012: 'Linear', + CameraProfile: 'Embedded', + CameraProfileDigest: '54650A341B5B5CCAE8442D0B43A92BCE', + HasSettings: true, + CropTop: 0, + CropLeft: 0, + CropBottom: 1, + CropRight: 1, + CropAngle: 0, + CropConstrainToWarp: 0, + HasCrop: false, + AlreadyApplied: true, + ToneCurvePV2012: [ '0, 0', '255, 255' ], + ToneCurvePV2012Red: [ '0, 0', '255, 255' ], + ToneCurvePV2012Green: [ '0, 0', '255, 255' ], + ToneCurvePV2012Blue: [ '0, 0', '255, 255' ], + Make: 'SONY', + Model: 'SLT-A55V', + XResolution: 240, + YResolution: 240, + ResolutionUnit: 'inches', + Software: 'Adobe Lightroom 5.4 (Macintosh)', + ExposureTime: 0.01, + FNumber: 1.8, + ExposureProgram: 'Manual', + ISO: 200, + SensitivityType: 2, + RecommendedExposureIndex: 200, + ExifVersion: '2.3.1', + DateTimeOriginal: '2015-10-19T00:59:38.000Z', + OffsetTime: '-07:00', + ShutterSpeedValue: 6.643856, + ApertureValue: 1.695994, + BrightnessValue: 3, + ExposureCompensation: 0, + MaxApertureValue: 1.7, + MeteringMode: 'Pattern', + LightSource: 'Cloudy weather', + Flash: 'Flash did not fire, compulsory flash mode', + FocalLength: 50, + ColorSpace: 1, + FileSource: 'Digital Camera', + SceneType: 'Directly photographed', + CustomRendered: 'Normal', + ExposureMode: 'Manual', + FocalLengthIn35mmFormat: 75, + SceneCaptureType: 'Standard', + Contrast: 'Normal', + LensModel: 'DT 50mm F1.8 SAM', + GPSVersionID: '2.2.0.0', + GPSLatitudeRef: 'N', + GPSLatitude: [ 33, 25.7121, 0 ], + GPSLongitudeRef: 'W', + GPSLongitude: [ 111, 55.57122, 0 ], + GPSAltitude: 354.7, + GPSTimeStamp: '19:2:7', + GPSStatus: 'V', + GPSMeasureMode: '3', + GPSSpeedRef: 'K', + GPSSpeed: 33.8, + GPSTrackRef: 'T', + GPSTrack: 0.36, + GPSMapDatum: 'WGS-84', + GPSDateStamp: '2015:10:09', + GPSDifferential: 0, + latitude: 33.428535, + longitude: -111.926187 +} \ No newline at end of file diff --git a/src/components/GalleryImage/GalleryImage.js b/src/components/GalleryImage/GalleryImage.js index a81794f..6af6433 100644 --- a/src/components/GalleryImage/GalleryImage.js +++ b/src/components/GalleryImage/GalleryImage.js @@ -63,6 +63,12 @@ const GalleryImage = ({ data, location: { state } }) => { setIsClient(true); }, []); + useEffect(() => { + requestAnimationFrame(() => { + window.scrollTo(0, 180); + }); + }, [image.base]); + const nextIndex = sortedImageList && currentIndex < sortedImageList.length ? currentIndex + 1 @@ -135,7 +141,7 @@ const GalleryImage = ({ data, location: { state } }) => { locationString = location.join(", "); } const vibrant = getVibrant(image, true); - const BLEND = 'hsl' + const BLEND = "hsl"; const darkAccent = chroma .mix(vibrant.Vibrant, "hsla(216, 0%, 90%, 1)", 0.6, BLEND) .hex(); @@ -145,7 +151,7 @@ const GalleryImage = ({ data, location: { state } }) => { ar > 1 ? "flex-col" : "portrait:mx-auto landscape:mx-5 landscape:flex-row-reverse portrait:flex-col"; - const verticalPad = ar > 1 ? "250px" : "100px"; + const verticalPad = ar > 1 ? "180px" : "20px"; const shutterSpeed = React.useMemo( () => diff --git a/src/components/KeywordsPicker.tsx b/src/components/KeywordsPicker.tsx index a5428bc..e0cd75f 100644 --- a/src/components/KeywordsPicker.tsx +++ b/src/components/KeywordsPicker.tsx @@ -1,44 +1,37 @@ import * as React from "react"; import classNames from "classnames"; -import Checkmark from "@spectrum-icons/workflow/Checkmark"; +import { Link } from "gatsby"; interface KeywordsPickerProps { keywords: string[]; value: string | null; - onChange: (val: string | null) => void; + getHref: (value: string | null) => string; + onPick: (value: string | null) => void; } -const KeywordsPicker = ({ keywords, value, onChange }: KeywordsPickerProps) => { +const KeywordsPicker = ({ keywords, value, getHref, onPick }: KeywordsPickerProps) => { return (
- - Collections - + Collections