{html_head} {/html_head} {combine_script id='jquery.jcrop' load='footer' require='jquery' path='themes/default/js/plugins/jquery.Jcrop.min.js'}

{$TITLE} › {'Edit photo'|@translate} {$TABSHEET_TITLE}

{'Photo sizes with crop'|@translate} {foreach from=$cropped_derivatives item=deriv} {$ALT} {/foreach}
{'Center of interest'|@translate}

{'The center of interest is the most meaningful zone in the photo.'|@translate} {'For photo sizes with crop, such as "Square", Piwigo will do its best to include the center of interest.'|@translate} {'By default, the center of interest is placed in the middle of the photo.'|@translate} {'Select a zone with your mouse to define a new center of interest.'|@translate}

{$ALT}

{footer_script} {literal} function from_coi(f, total) { return f*total; } function to_coi(v, total) { return v/total; } function jOnChange(sel) { var $img = jQuery("#jcrop"); jQuery("#l").val( to_coi(sel.x, $img.width()) ); jQuery("#t").val( to_coi(sel.y, $img.height()) ); jQuery("#r").val( to_coi(sel.x2, $img.width()) ); jQuery("#b").val( to_coi(sel.y2, $img.height()) ); } function jOnRelease() { jQuery("#l,#t,#r,#b").val(""); } {/literal} jQuery("#jcrop").Jcrop( {ldelim} boxWidth: 500, boxHeight: 400, onChange: jOnChange, onRelease: jOnRelease } {if isset($coi)} ,function() {ldelim} var $img = jQuery("#jcrop"); this.animateTo( [from_coi({$coi.l}, $img.width()), from_coi({$coi.t}, $img.height()), from_coi({$coi.r}, $img.width()), from_coi({$coi.b}, $img.height()) ] ); } {/if} ); {/footer_script}