I've managed to make Filepond upload files, put them in the right folder and add the necessary details to a mysql database. However, since the original images are very high resolution, I need to make thumbnails. Smaller versions of the images that should go in a subfolder called "thumbnails".
I am using the PHP boiler plate, and some of the documentation don't cover the methods used there. For instance, I tried, just for testing, to do this:
FilePond.setOptions({
maxFileSize: '25MB',
instantUpload: true,
server: 'api/',
imageTransformVariants: {
'thumb_medium_': transforms => {
transforms.resize.size.width = 384;
return transforms;
},
'thumb_small_': transforms => {
transforms.resize.size.width = 128;
return transforms;
}
}
});
let pond = FilePond.create(document.querySelector('input[type="file"]'));
Which gives me this error:
index.php?id=1383:67 Uncaught (in promise) TypeError: Cannot read property 'size' of undefined
at thumb_medium_ (index.php?id=1383:67)
at filepond-plugin-image-transform.js:898
at filepond-plugin-image-transform.js:987
at new Promise (<anonymous>)
at filepond-plugin-image-transform.js:986
at filepond-plugin-image-transform.js:1066
at Array.map (<anonymous>)
at filepond-plugin-image-transform.js:1065
at new Promise (<anonymous>)
at filepond-plugin-image-transform.js:941
Obviously I could make a second Filepond-upload for the thumbnails but I suspect there should be a way to do this automatically. How do I make variants work and also, how to make them in a different folder and the same filename, rather than giving them a prefix?