Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f316afa

Browse files
committed
fix(gatsby-plugin-image): Apply inline styles and img size (#29603)
(cherry picked from commit 9db36db)
1 parent be9d9f9 commit f316afa

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
@@ -60,6 +60,12 @@ export function getWrapperProps(
6060

6161
let className = `gatsby-image-wrapper`
6262

63+
// If the plugin isn't installed we need to apply the styles inline
64+
if (!global.GATSBY___IMAGE) {
65+
wrapperStyle.position = `relative`
66+
wrapperStyle.overflow = `hidden`
67+
}
68+
6369
if (layout === `fixed`) {
6470
wrapperStyle.width = width
6571
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)