问题描述:

I have a Plupload uploader running, which is making both a thumbnail and a large size image when uploading each image.

The thumbnail I need to make fit into a 150x150px box. I have some javascript that scales the image down, so that the smallest width or height of the image gets to be 150px, and the bigger one is hidden with overflow:hidden.

The problem is when I use the Plupload script for resizing, it only takes "maximum" sizes for width and height, meaning that if I have a image that have a 1:2 ratio, it would be resized to 75x150px.

Is there any way of making this work as minimum sizes?

This is how my thumbnail resize looks at the moment:

var uploader = $('#uploader').pluploadQueue();

uploader.bind('BeforeUpload', function(up, file) {

if('thumb' in file){

up.settings.url = 'upload.php?dir=' + ($("#chosen_gallery :selected").val()) + '&subdir=thumbs',

up.settings.resize = {width : 150, height : 150, quality : 60};

}

}

网友答案:

Use the crop:true value on the resize settings object. Will scale to the shorter side, then crop the ends to match your specified width/height

相关阅读:
Top