Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gatsby-image-sharp missing 'resize' export #6394

Closed
cupojoe opened this issue Jul 11, 2018 · 12 comments · Fixed by #6418
Closed

gatsby-image-sharp missing 'resize' export #6394

cupojoe opened this issue Jul 11, 2018 · 12 comments · Fixed by #6418
Labels
help wanted Issue with a clear description that the community can help with.

Comments

@cupojoe
Copy link
Contributor

cupojoe commented Jul 11, 2018

Description

According to the documentation for gatsby-image-sharp v2 beta 3 there is a method called resize to just resize one image. Trying to import this method from the package fails and looking at the source the export is not there:

exports.queueImageResizing = queueImageResizing
exports.base64 = base64
exports.traceSVG = traceSVG
exports.sizes = fluid
exports.resolutions = fixed
exports.fluid = fluid
exports.fixed = fixed
exports.getImageSize = getImageSize

Should it be added or the documentation updated?

@LekoArts
Copy link
Contributor

You would use resize in the GraphQL query. Or what did you try to do?

@m-allanson m-allanson added type: question or discussion Issue discussing or asking a question about Gatsby help wanted Issue with a clear description that the community can help with. type: documentation An issue or pull request for improving or updating Gatsby's documentation and removed type: question or discussion Issue discussing or asking a question about Gatsby labels Jul 12, 2018
@m-allanson
Copy link
Contributor

m-allanson commented Jul 12, 2018

@cupojoe I'd be interested to hear what you're aiming to do!

I just had a dig through the history of gatsby-image-sharp, and it doesn't look like resize has ever been exported. Resize operations are instead handled by the queueImageResizing function, which is designed to work with Gatsby file nodes rather than file paths directly.

See the tests for example usages, or take a look at extend-node-type.js in gatsby-transformer-sharp to see how this is hooked up to resize() in a GraphQL query.

I'd love to see a PR updating the docs to remove resize and include queueImageResizing if you or anyone else is interested.

Edit to add: @LekoArts is right, typically you wouldn't use these functions directly, but via a GraphQL query. Check out the image processing example (src) to see how that'd look.

@KyleAMathews
Copy link
Contributor

We could export a resize function that just calls queueImageResizing if someone wanted to PR that.

@cupojoe
Copy link
Contributor Author

cupojoe commented Jul 12, 2018

I'm making a gatsby plugin to process poster attributes so you can add html 5 video tags directly into the markdown files (using plain html).
I think exporting resize as an alias would be great since that is what is documented in the package and it can be confusing that it doesn't work while the docs refer to it.

@KyleAMathews
Copy link
Contributor

Sounds like a sweet plugin! And yeah! Please PR the change!

@cupojoe
Copy link
Contributor Author

cupojoe commented Jul 12, 2018

@KyleAMathews will do, also a PR to include the plugin in the plugins registry. Gotta checkout the plugin contribution guidelines first :)

@KyleAMathews
Copy link
Contributor

Sweet! Plugins btw are auto pulled in if you add "gatsby-plugin" as a keyword

@cupojoe
Copy link
Contributor Author

cupojoe commented Jul 12, 2018

you mean if I add gatsby-plugin as a keyword in the package.json and also include the plugin in a pr to the gatsby mono repo?

@KyleAMathews
Copy link
Contributor

We're suggesting that most plugins should be maintained in your own repo. We like to maintain some really core plugins here that are widely used but we have limited bandwidth so most plugins we ask authors to keep in your own repo. But definitely want it in the plugin library so please add the keyword to your package.json so it shows up!

@cupojoe
Copy link
Contributor Author

cupojoe commented Jul 12, 2018

sounds good 👍

@m-allanson m-allanson added 🏷 type: feature and removed type: documentation An issue or pull request for improving or updating Gatsby's documentation labels Jul 12, 2018
@cupojoe
Copy link
Contributor Author

cupojoe commented Jul 12, 2018

Added the plugin: https://www.npmjs.com/package/gatsby-remark-video-poster
On to that PR now

@cupojoe
Copy link
Contributor Author

cupojoe commented Jul 13, 2018

@KyleAMathews I can see the new plugin in the list of plugins, but if you select it you get a 404. Did I miss something for it to populate correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue with a clear description that the community can help with.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants