/html5-make-thumb

HTML5 Make thumb

Primary LanguageJavaScript

html5-make-thumb

Create thumbnail with HTML5.

Useage

<iframe name="ifr" style="display: none;"></iframe> 
<form id="j-form" target="ifr" action="api.php" method="post" enctype="multipart/form-data">
    <input type="file" name="upfile" id="j-file" />
</form>
<script src="jquery.js"></script>
<script src="jquery.make-thumb.js"></script>
var $form = $('#j-form');
var $file = $('#j-file');
$file.makeThumb({
    width: 400,
    height: 400,
    mark: {padding: 5, src: 'mark.png', width: 30, height: 30},
    success: function(dataURL, tSize, file, sSize, fEvt) {
        // post data
        var $up = $('<input type="hidden" name="base64">');
        $up.insertAfter($file).val(dataURL);
        $file.remove();
        $form.submit();
    }
});

docs

reference