innostudio / fileuploader

Beautiful and powerful HTML file uploading tool. A jQuery, PHP and Node.js plugin that transforms the standard input into a revolutionary and fancy field on your page.
141 stars 25 forks source link

How to set multi ratio size on multi instance of fileuploader on a page #54

Closed mrhieuit closed 4 years ago

mrhieuit commented 4 years ago

I have a page with multi instance of fileuploader on the page. How I set ratio size for each instance of fileuploader on this page.

For example:

And allow the user to crop the image again by dragging the crop area. Keep the default aspect ratio size set for each item of Fileuploader on the page.

Please help me. Best regards!

mrhieuit commented 4 years ago

Hi @innostudio, are there any solutions to this problem? I'm using Asp.Net Webform. Please help me. Best regards!

innostudio commented 4 years ago

@mrhieuit here is a way how you can do that:

  1. using .each() jQuery method

    <input type="file" name="files" data-ratio="1">
    $('input:file').each(function(index, el) {
    var $el = $(el),
        ratio = $el.attr('data-ratio');
    
    $el.fileuploader({
        editor: {
            cropper: {
                ratio: ratio
            }
        }
    });
    });
mrhieuit commented 4 years ago

I got it. Thank you so much