我有问题当我在多个页面上传pdf文件时,会多次生成拇指。
我的代码在
之下var image = random() + '.png';
imagename = 'uploads/document_thumb/' + image;
var pathToFile = path.join(__dirname, req.files[i].path)
, pathToSnapshot = path.join(__dirname, '/uploads/document_thumb/' + image);
im.resize({
srcPath: pathToFile
, dstPath: pathToSnapshot
, width: 150
, height: 150
, quality: 0
, gravity: "North"
},
function (err, stdout, stderr) {
if (err) {
console.log(err);
}
console.log('resized image', pathToSnapshot);
});
如何设置只生成一个页面拇指生成。
答案 0 :(得分:0)
我使用GraphicsMagick生成Pdf文件的缩略图。
#include <iostream>
namespace A {
namespace B {
struct C {
struct D {
int e; // variable e lifetime is same with struct D lifetime. Available only within struct D initialized
D() : e(42) {}
} d; // variable d lifetime is samw with C struct lifetime. Available only within struct C initialized
C() {}
C(int v) {
d.e = v;
}
} c; // variable c lifetime is entire program. Scope is A::B::c
}
}
int main() {
// access variable with program lifetime in A::B namespace
std::cout << A::B::c.d.e << std::endl;
// create local variable of type A::B::C and access its fields
A::B::C myc(55);
std::cout << myc.d.e << std::endl;
// declare struct F within main function scope and access its fields
struct F {
int g;
F(int v) : g(v) { }
} f (100);
std::cout << f.g << std::endl;
return 0;
}