Support » Plugins and Hacks » [Plugin: Scissors] Small Resizing Feature Request

  • Resolved alkafy


    As you type the units to resize one dimension of an image, it would be great if the other dimension was dynamically calculated and displayed. Not a huge deal – it would just be a little helpful. Otherwise, incredibly useful plugin. Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Sounds good and should be simple to implement. Thanks for the suggestion!

    I’m sure you could do this more elegantly, but I hacked together a solution:

    Line 768 scissors.php

    $resizeValue = "<input style='width:3em;text-align:center;' type='text' id='scissorsSide-$postId' value='640' onkeyup=\"scissorsCalcResize($postId)\" />";

    New Function in scissors.js

    function scissorsCalcResize(id) {
    var resizeDim = Number(jQuery(‘#scissorsSide-‘+id).val());
    var dimensions = jQuery(‘#scissorsSize-‘+id).html().split(‘ × ‘);
    var width = Number(dimensions[0]);
    var height = Number(dimensions[1]);
    var resizeMode = jQuery(‘#scissorsMode-‘+id).val();

    if (resizeMode!=’width’ && resizeMode!=’height’) {
    var longSide = ‘width’;
    var shortSide = ‘height’;
    if (width<height) {
    longSide = ‘height’;
    shortSide = ‘width’;
    if (resizeMode==’long’) {
    resizeMode = longSide;
    }else {
    resizeMode = shortSide;

    if (resizeMode==’width’) {
    height = Math.floor((resizeDim/width)*height);
    width = resizeDim;
    } else {
    width = Math.floor((resizeDim/height)*width);
    height = resizeDim;

    if (jQuery(‘#newSizes-‘+id).length==0) {
    jQuery(‘#scissorsSize-‘+id).after(‘<span id=”newSizes-‘+id+'”></span>’);
    jQuery(‘#newSizes-‘+id).html(‘ Calculated Size: ‘+width+’ x ‘+height);

    Implemented and part of the new development version (find it under ‘other versions’). Please test it and if you’re satisfied mark this thread as resolved. Thanks!

    Nicely done. Thank you very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Scissors] Small Resizing Feature Request’ is closed to new replies.