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

Images are not processed #33

Open
expwez opened this issue Dec 1, 2020 · 1 comment
Open

Images are not processed #33

expwez opened this issue Dec 1, 2020 · 1 comment

Comments

@expwez
Copy link

expwez commented Dec 1, 2020

After the latest update (1.1.0), I keep retrieving the same exception while trying to use the package. The exception is:

TypeError: Cannot read property 'slice' of undefined
    at getMIMEType (/srv/app/node_modules/gulp-jimp-wrapper/dist/index.js:25:51)
    at Transform.through__default.default.obj [as _transform] (/srv/app/node_modules/gulp-jimp-wrapper/dist/index.js:62:24)
    at Transform._read (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_transform.js:177:10)
    at Transform._write (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_transform.js:164:83)
    at doWrite (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_writable.js:409:139)
    at writeOrBuffer (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_writable.js:398:5)
    at Transform.Writable.write (/srv/app/node_modules/gulp-jimp-wrapper/node_modules/readable-stream/lib/_stream_writable.js:307:11)
    at write (/srv/app/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:623:24)
    at flow (/srv/app/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:632:7)
    at DestroyableTransform.pipeOnReadable (/srv/app/node_modules/vinyl-fs/node_modules/readable-stream/lib/_stream_readable.js:664:5)

And I am using the package like this:

return gulp.src(imagesConfig.source)
                .pipe(function (image) {
                    image.resize(size.width, size.height);
                    image.crop(crop.x, crop.y, crop.width, crop.height);

                    return image;
                })
                .pipe(gulp.dest(imagesConfig.destination));

Is there any solution for me in this situation?

@exuanbo
Copy link
Owner

exuanbo commented Dec 1, 2020

slice() is called when getting the MIME type of the image.

const getMIMEType = img => MIME_TYPES[img.extname.slice(1).toLowerCase()]

It seems the property extname is somehow undefined in the Vinyl instance.

Can you provide some examples of your imagesConfig.source?

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

2 participants