If you need to set converters in runtime you will need to set two extra events of aurigma uploader: 1.BeforeUpload and 2. BeforePackageUpload:
uploader = new Uploader('Uploader1');
...
$uploader->getClientEvents()->setBeforeUpload("BeforeUpload");
$uploader->getClientEvents()->setBeforePackageUpload("BeforePackageUpload");
...
Then implement the code of events in Javascript block (script type = "text/javascript").
You will need to get widths and heights of all the images added to the upload pane and put these values to arrays. In BeforePackageUpload you should take values of width and height of each file and compare them to set needed converter fit mode:
//set new arrays
var widths = [];
var heights = [];
function BeforeUpload() {
var uploader = $au.uploader('Uploader1');
count = uploader.files().count();
for (i = 0; i < count; i++) {
widths[i] = uploader.files().get(i).width();
heights[i] = uploader.files().get(i).height();
}
}
function BeforePackageUpload(index) {
var uploader = $au.uploader('Uploader1');
if (widths.shift() > heights.shift()) {
uploader.converters([{
mode: '*.*=Thumbnail',
thumbnailFitMode: 'Width',
thumbnailWidth: 500,
thumbnailHeight: 300,
thumbnailJpegQuality: 100
}]);
}
else
{
uploader.converters([{
mode: '*.*=Thumbnail',
thumbnailFitMode: 'Height',
thumbnailWidth: 300,
thumbnailHeight: 500,
thumbnailJpegQuality: 100
}]);
}
}