i'm trying to create a thumbnail of an image i uploaded to the server:
var w = img.width, h = img.height;
var neww = 75, newh = 75;
var wRatio = (neww / w);
var hRatio = (newh / h);
var cropw, croph;
var srcx = 0, srcy = 0;
if (w > h) {
cropw = Math.round(w * hRatio);
croph = newh;
srcx = Math.ceil( (w - h) / 2);
}
else if (w < h) {
croph = Math.round(h * wRatio);
cropw = neww;
srcy = Math.ceil( (h - w) / 2);
}
else {
cropw = neww;
croph = newh;
}
var target = gd.createTrueColor(neww, newh);
img.copyResampled(target, 0, 0, srcx, srcy, cropw, croph, img.width, img.height);
target.saveJpeg(dest, 90, function() {
// ...
});
the thumbnail isn't created but i don't know why and i don't get an error ... :(