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

prismicH.asImageSrc using width instead of w doesn't do anything #63

Closed
Odas0R opened this issue Feb 20, 2023 · 2 comments
Closed

prismicH.asImageSrc using width instead of w doesn't do anything #63

Odas0R opened this issue Feb 20, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Odas0R
Copy link

Odas0R commented Feb 20, 2023

Versions

  • @prismicio/helpers: ^2.3.9
  • node: v16.17.1

Steps to reproduce

  const imgSrc = prismicH.asImageSrc(images[0]?.image, {
    width: 250, // does not work
    height: 250, // does not work
    q: 75,
    fm: "webp",
    fit: "crop",
  });

  const imgSrc = prismicH.asImageSrc(images[0]?.image, {
    w: 250, // works
    h: 250, // works
    q: 75,
    fm: "webp",
    fit: "crop",
  });

What is expected?

Using the param width and height optimize the image

What is actually happening?

The param width and height have no effect

@Odas0R Odas0R added the bug Something isn't working label Feb 20, 2023
@github-actions
Copy link

This issue has been labeled as a bug since it was created using the 🚨 Bug Report Template.

Hi there, thank you so much for the report!

Following our Maintenance Process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue includes the following:

  • Information about your environment and packages you use (Node.js version, package names and their versions, etc.)
    Feel free to attach a copy of your package.json file.
  • Any troubleshooting steps you already went through
  • A minimal reproduction of the issue, and/or instructions on how to reproduce it

If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request addressing it. Check out our quick start guide for a simple contribution process.

If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io

- The Prismic Open-Source Team

@lihbr
Copy link
Member

lihbr commented Jul 5, 2023

Hey there, thank you so much for contributing. I'm sorry we failed to get back to you in a timely manner.

I tried reproducing without success, those tests pass as expected (committed version: 5ee387a /CI results: https://github.com/prismicio/prismic-helpers/actions/runs/5465804619/jobs/9949788226):

expect(
	asImageSrc(field, {
		w: 250,
		h: 250,
		q: 75,
		fm: "webp",
		fit: "crop",
	}),
).toBe(`${field.url}&w=250&h=250&q=75&fm=webp&fit=crop`);
expect(
	asImageSrc(field, {
		width: 250,
		height: 250,
		q: 75,
		fm: "webp",
		fit: "crop",
	}),
).toBe(`${field.url}&width=250&height=250&q=75&fm=webp&fit=crop`);

Equivalent images appear to be rendered as expected:

I'm confused if I got your issue correctly, maybe this was a regression back then on Imgix's end? Well let me know, I'm closing it for now but happy to reopen~

@lihbr lihbr closed this as completed Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants