Make WordPress Core


Ignore:
Timestamp:
03/27/2009 04:45:55 PM (16 years ago)
Author:
ryan
Message:

Use Jcrop for cropping. see #9375

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-header.php

    r10623 r10846  
    8080            wp_enqueue_script('farbtastic');
    8181        elseif ( 2 == $step )
    82             wp_enqueue_script('cropper');
     82            wp_enqueue_script('jcrop');
    8383    }
    8484
     
    9191        $step = $this->step();
    9292
    93         if ( 1 == $step ) {
     93        if ( 1 == $step )
    9494            wp_enqueue_style('farbtastic');
    95         }
     95        elseif ( 2 == $step )
     96            wp_enqueue_style('jcrop');
    9697    }
    9798
     
    216217    function js_2() { ?>
    217218<script type="text/javascript">
    218     function onEndCrop( coords, dimensions ) {
    219         jQuery( '#x1' ).val(coords.x1);
    220         jQuery( '#y1' ).val(coords.y1);
     219    function onEndCrop( coords ) {
     220        jQuery( '#x1' ).val(coords.x);
     221        jQuery( '#y1' ).val(coords.y);
    221222        jQuery( '#x2' ).val(coords.x2);
    222223        jQuery( '#y2' ).val(coords.y2);
    223         jQuery( '#width' ).val(dimensions.width);
    224         jQuery( '#height' ).val(dimensions.height);
     224        jQuery( '#width' ).val(coords.w);
     225        jQuery( '#height' ).val(coords.h);
    225226    }
    226227
     
    241242            }
    242243        }
    243         new Cropper.Img(
    244             'upload',
    245             {
    246                 ratioDim: { x: xinit, y: yinit },
    247                 displayOnInit: true,
    248                 onEndCrop: onEndCrop
    249             }
    250         )
     244
     245        $('#upload').Jcrop({
     246            aspectRatio: ratio,
     247            setSelect: [ 0, 0, xinit, yinit ],
     248            onSelect: onEndCrop
     249        });
    251250    });
    252251</script>
Note: See TracChangeset for help on using the changeset viewer.