I am developing a iOS app using Ionic 1.7.15 and Cordova 6.2.0. The app downloads a lot of imagens from the internet and I want to generate a thumbnail for each imagen downloaded. So I can have two versions of each image, the thumbnail and the original one.
The plugin works just fine in Android. But in my iPad 2, the app crashes after resizing lots of imagens (lets say after 500 imagens).
I wonder if I am doing something wrong, forgetting to free some resources or something like that.
var filePath = cordova.file.dataDirectory + image.fileName;
var options = {
uri: filePath,
image:image.fileName,
folderName: "Thumbnails",
quality: 100,
width: 170,
height: 140};
window.ImageResizer.resize(options,
function(thumbnailPath) {
RepositoryService.updateImage(resultado.nativeURL, thumbnailPath, image.id)
.then(function() {
resolve({"id": image.id, "fileName": image.fileName});
}).catch(function(error) {
console.log(error);
reject({"description": "Error updating image on the database", "error": error});
});
}, function(error) {
// failed: grumpy cat likes this function
console.log(error);
});