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

.max is not a function #1731

Closed
pthieu opened this issue May 29, 2019 · 4 comments
Closed

.max is not a function #1731

pthieu opened this issue May 29, 2019 · 4 comments

Comments

@pthieu
Copy link

pthieu commented May 29, 2019

What is the output of running npx envinfo --binaries --languages --system --utilities?

npx: installed 1 in 3.838s

  System:
    OS: macOS Sierra 10.12.6
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 85.00 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
    npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 4.2.1 - /usr/bin/gcc
    Git: 2.19.1 - /usr/local/bin/git
  Languages:
    Bash: 3.2.57 - /bin/bash
    Java: 1.8.0_202 - /usr/bin/javac
    Perl: 5.18.2 - /usr/bin/perl
    PHP: 5.6.30 - /usr/bin/php
    Python: 2.7.10 - /usr/bin/python
    Ruby: 2.0.0 - /usr/bin/ruby

My sharp version is 0.22.1

What are the steps to reproduce?
Run code below

What is the expected behaviour?
Resize occurs successfully. Removing .max causes the code to work

Are you able to provide a standalone code sample, without other dependencies, that demonstrates this problem?

      const fetch = require('node-fetch');

      const url = https://litcouncil.com/wp-content/uploads/resultados-test_9.jpg
      const imgBuffer = await (await fetch(url)).buffer();
      const resizedImage = await sharp(imgBuffer)
        .clone()
        .resize(width, height)
        .max()
        .toFormat(sharp.format.png);

Are you able to provide a sample image that helps explain the problem?
image

Funny thing is .trim, .background, and .embed aren't there either.

@pthieu
Copy link
Author

pthieu commented May 29, 2019

Just read the changelog

Looks like a number of functions are deprecated and moved to params.

@pthieu pthieu closed this as completed May 29, 2019
@select
Copy link

select commented Jul 2, 2019

Here is the relevant line of the changelog:

max().withoutEnlargement() is now resize(width, height, { fit: 'inside', withoutEnlargement: true })

@mattgaspar
Copy link

@lovell can you please follow Semantic Versioning so these breaking changes are more apparent.

https://semver.org/

Also, why is the library not at version 1? Is it not production ready?

@lovell
Copy link
Owner

lovell commented Nov 12, 2019

@mattgaspar Please see #1448 #1754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants