Search code examples
phpimage-resizingaurigma

Aurigma file uploader php how to size thumbs with correct ratio


I am using aurigma a commercial multi file uploader and cropper.

I am tring to upload images of various aspect ratios and sizes.

I want them to fit into boxes that are 140*140 pixels.

If the height is the smallest attribut of the image I want that to be 140 pixels or vice versa on the width.

Overlap are allowed.

I have looked through the official site and documentation but cannot understand how to do this.

To clarify if an image is 100 * 50 pixels I want it resized to 210 * 140 or an image that is 50*100 should be 140 * 210.

I haven't uploaded any code as the code I have used is available on the main site and I have added nothing specific.

www.aurigma.com/


Solution

  • Did you try to use OrientationalFit?

    It works like a Fit mode but with correction on thumbnail orientation.

    $au.uploader({
        id: 'Uploader1',
        converters: [
            { mode: '*.*=Thumbnail', thumbnailFitMode: 'OrientationalFit',
                thumbnailWidth: 210, thumbnailHeight: 140, 
                thumbnailJpegQuality: 80 }
        ]
    });
    

    Results:

    3072 x 2304 => 187 x 140
    2304 x 3072 => 140 x 187
    

    And one more thing about you sample. Image Uploader cannot be used for upsizing, i.e. thumbnail cannot be larger than source image. This is by design.