根据我正在处理的教程,下面的代码告诉gm
调整图片就地。
它没有这样做。它吐出相同的图像文件。
newForm.on('end', function() {
fs.rename(tmpFile, nfile, function() {
// resize image and upload to S3 bucket
// I fs.read(nfile) here, log the buffer contents, and...
gm(nfile).resize(300).write(nfile, function(err) {
// I fs.read(nfile) again, and the buffer contents
// are identical.
// The file has not been resized
// upload to S3, etc
// the unresized image is incorrectly uploaded to S3
})
})
})
我的.write
错了吗?
我在控制台中收到此错误
(node) Buffer.write(string, encoding, offset, length) is deprecated. Use write(string[, offset[, length]][, encoding]) instead.
但它没有给我任何改变的线索......