Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions packages/gatsby-plugin-sharp/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ const processFile = (file, jobs, cb, reporter) => {
} else {
clonedPipeline = pipeline
}
// Sharp only allows ints as height/width. Since height isn't always
// set, check first before trying to round it.
let roundedHeight = args.height
if (roundedHeight) {
roundedHeight = Math.round(roundedHeight)
}
const roundedWidth = Math.round(args.width)
// Sharp only allows ints as height/width. Since either height or width
// could not be set, check first before trying to round them.
let roundedHeight = args.hasOwnProperty(args, `height`)
? Math.round(args.height)
: undefined
const roundedWidth = args.hasOwnProperty(args, `width`)
? Math.round(args.width)
: undefined
clonedPipeline
.resize(roundedWidth, roundedHeight)
.crop(args.cropFocus)
Expand Down
2 changes: 0 additions & 2 deletions packages/gatsby-transformer-sharp/src/extend-node-type.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ const fixedNodeType = ({
args: {
width: {
type: GraphQLInt,
defaultValue: 400,
},
height: {
type: GraphQLInt,
Expand Down Expand Up @@ -222,7 +221,6 @@ const fluidNodeType = ({
args: {
maxWidth: {
type: GraphQLInt,
defaultValue: 800,
},
maxHeight: {
type: GraphQLInt,
Expand Down