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

INVALID_EXTENSION - .jpg #25

Open
polfernandez opened this issue Feb 8, 2018 · 2 comments
Open

INVALID_EXTENSION - .jpg #25

polfernandez opened this issue Feb 8, 2018 · 2 comments

Comments

@polfernandez
Copy link

polfernandez commented Feb 8, 2018

When I try to resize/compress a .jpg file from an android device, I keep getting "INVALID_EXTENSION" error. But for .png, or .jpeg files works fine.

Output:

Input image
Blob(225073) {size: 225073, type: "image/jpg"} size: 225073 type: "image/jpg" __proto__: Blob
Output error
{compressedFile: Blob(225073), reason: "File provided is neither of type jpg nor of type png.", error: "INVALID_EXTENSION"} {resizedFile: Blob(225073), reason: "The provided File is neither of type jpg nor of type png.", error: "INVALID_EXTENSION"}

@polfernandez polfernandez changed the title INVALID_EXTENSION INVALID_EXTENSION - .jpg Feb 8, 2018
@snahrvar
Copy link

Having the exact same issue. Is the package working?

@vighnu
Copy link

vighnu commented Mar 15, 2018

Well, I had faced the same issue I fixed this issue as shown below.

I had File called originalImage, i clone it to another File called modifieldImage

the code for the clone is as shown

const modifieldImage= new File(
          [uploadImage.originalImage],
          uploadImage.originalImage.name,
          {
            type: uploadImage.originalImage.type
          }
        );

//then call the api
this.ng2ImgMax .resizeImage(modifieldImage, 1600, 1176) ...



** try adding the 'type' while creating the File. That may fix the issue. **


Hope it helps someone.

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

No branches or pull requests

4 participants