Possible to add a height restriction as well?
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- javascript
- Domain
- tooling
Research direction
Start from the eleventyImageTransformPlugin configuration and trace how widths and sharpOptions are passed to the image resize step. Reproduce the example with an image larger than 1000px, then verify that the output is proportionally scaled with neither dimension exceeding 1000px and that existing width behavior remains intact.
Written by the indexing model from the issue text.
Description
I'm functionally attempting to replicate the behavior of an imagemagick -resize 1000x1000 command, where the output is just going to be a proportionately scaled image with the largest dimension being no more than 1000px. Sharp seems to be able to do this thanks to withoutEnlargement: true and fit: inside but I'm running into issues trying to pass sharp options.
I've tried a ton of permutations of the below (specifying widths instead of auto, using sharpResizeOptions, so on and so forth), but nothing seems to take. The sharp width and height options just seem to be fully ignored no matter what
eleventyConfig.addPlugin(eleventyImageTransformPlugin, {
// output image formats
formats: ["webp"],
// output image widths
widths: ["auto"],
outputDir: "public_html/data/",
urlPath: "/data/",
sharpOptions: {
resize: {
width: 1000,
height: 1000,
fit: "inside",
withoutEnlargement: true
}
},
});
At this point I'm not sure if I'm doing something wrong or if this is just unsupported behavior, and if it is the latter, would supporting it be a potential enhancement? I know most folks are doing something way more complicated than my use case, which is just a simple 1 size transform, but having the option to easily override the plugin's "widths" (assuming that is where the issue rests) and specify via sharpOptions instead would be handy here.
- Dominant language
- JavaScript
- Stars
- 467
- Forks
- 65
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from 11ty/image
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100