Skip to content

Commit 9db36db

Browse files
authored
fix(gatsby-plugin-image): Apply inline styles and img size (#29603)
1 parent 6bee561 commit 9db36db

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/gatsby-plugin-image/src/components/hooks.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ export function getWrapperProps(
6262

6363
let className = `gatsby-image-wrapper`
6464

65+
// If the plugin isn't installed we need to apply the styles inline
66+
if (!global.GATSBY___IMAGE) {
67+
wrapperStyle.position = `relative`
68+
wrapperStyle.overflow = `hidden`
69+
}
70+
6571
if (layout === `fixed`) {
6672
wrapperStyle.width = width
6773
wrapperStyle.height = height

packages/gatsby-plugin-image/src/components/lazy-hydrate.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ export function lazyHydrate(
8484
)}
8585
<MainImage
8686
{...(props as Omit<MainImageProps, "images" | "fallback">)}
87+
width={width}
88+
height={height}
8789
className={imgClassName}
8890
{...getMainProps(
8991
isLoading,

0 commit comments

Comments
 (0)