diff --git a/gatsby/src/templates/gallery-image.js b/gatsby/src/templates/gallery-image.js index accf428..d8cdfca 100644 --- a/gatsby/src/templates/gallery-image.js +++ b/gatsby/src/templates/gallery-image.js @@ -6,27 +6,40 @@ import { Helmet } from "react-helmet"; const GalleryImage = ({ pageContext, data }) => { const image = data.allFile.edges[0].node - console.log(getMeta(image)); + const ar = image.childImageSharp.fluid.aspectRatio; + console.log(ar); + // const imageStyle = {} + // if (ar > 1) { + // imageStyle.width = '90vw' + // } else { + // imageStyle.height = '90vh' + // } + const name = getName(image); return (<> - - {name} - Gallery | Chuck Dries - - -
-

{name}

- -

{getMeta(image).iptc.caption}

+ + {name} - Gallery | Chuck Dries + + +
+ {/* use inline-block to set width to same as children but it still doesn't work for vert images */} + {/* todo: totally different layout for vertical images? by inspecting aspect ratio? Ohhhh yes */} +
+

{name}

+ +

{getMeta(image).iptc.caption}

+
); } @@ -44,7 +57,7 @@ export const query = graphql` } gatsbyImageData( layout: CONSTRAINED - placeholder: BLURRED + # placeholder: BLURRED # placeholder: DOMINANT_COLOR # placeholder: TRACED_SVG height: 2048