Skip to content

Commit

Permalink
Merge pull request #1 from imgeng/auto_dimensions
Browse files Browse the repository at this point in the history
Set dimensions to auto if missing on gatsbyImage resolver
  • Loading branch information
mnussbaumer authored Nov 30, 2021
2 parents 49506b7 + 530fb36 commit ff31ffc
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function responsive_details_field_resolver(context: any): SchemaField {
{ height, width, images} = resolved,
{ sizes, srcSet } = images.sources[0];

return {width: width, height: height, sizes: sizes, srcset: srcSet, src: final_url};
return {width: width, height: height, sizes: sizes, srcSet: srcSet, src: final_url};
}
};
};
Expand Down Expand Up @@ -176,7 +176,7 @@ function ie_from_gatsby_image_resolver(url: string, width: any, height: any, for
format: final_format
};

return {src: build_IE_url(url, final_args), width, height, format};
return {src: build_IE_url(url, final_args), width: width || "auto", height: height || "auto", format};
};


Expand Down Expand Up @@ -217,10 +217,6 @@ const gatsby_args = {
type: "[Int]",
description: "Specifies the image widths to generate. You should rarely need to change this. For FIXED and CONSTRAINED images it is better to allow these to be determined automatically, based on the image size. For FULL_WIDTH images this can be used to override the default, which is determined by the plugin. It will never generate any images larger than the source.",
},
placeholder: {
type: "GatsbyImagePlaceholder",
description: "Format of generated placeholder image, displayed while the main image loads. BLURRED: a blurred, low resolution image, encoded as a base64 data URI (default) DOMINANT_COLOR: a solid color, calculated from the dominant color of the image. TRACED_SVG: a low-resolution traced SVG of the image. NONE: no placeholder. Set the argument 'backgroundColor' to use a fixed background color.",
},
backgroundColor: {
type: "String",
description: "Background color applied to the wrapper, or when 'letterboxing' an image to another aspect ratio.",
Expand Down

0 comments on commit ff31ffc

Please sign in to comment.