diff --git a/admin/configuration.php b/admin/configuration.php index 34117efd7..7ab175c53 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -445,6 +445,50 @@ switch ($page['section']) ); } + // derivaties = multiple size + $enabled = ImageStdParams::get_defined_type_map(); + $disabled = @unserialize(@$conf['disabled_derivatives']); + if ($disabled === false) + { + $disabled = array(); + } + + $tpl_vars = array(); + foreach(ImageStdParams::get_all_types() as $type) + { + $tpl_var = array(); + + $tpl_var['must_square'] = ($type==IMG_SQUARE ? true : false); + $tpl_var['must_enable'] = ($type==IMG_SQUARE || $type==IMG_THUMB)? true : false; + + if ($params=@$enabled[$type]) + { + $tpl_var['enabled']=true; + } + else + { + $tpl_var['enabled']=false; + $params=@$disabled[$type]; + } + + if ($params) + { + list($tpl_var['w'],$tpl_var['h']) = $params->sizing->ideal_size; + if ( ($tpl_var['crop'] = round(100*$params->sizing->max_crop)) > 0) + { + list($tpl_var['minw'],$tpl_var['minh']) = $params->sizing->min_size; + } + else + { + $tpl_var['minw'] = $tpl_var['minh'] = ""; + } + $tpl_var['sharpen'] = $params->sharpen; + $tpl_var['quality'] = $params->quality; + } + $tpl_vars[$type]=$tpl_var; + } + $template->assign('derivatives', $tpl_vars); + break; } } diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index faa3d8517..ca54e90d1 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -268,11 +268,17 @@ jQuery(document).ready(function () { {if isset($sizes)} -{footer_script}{literal} +{footer_script} +var labelMaxWidth = "{'Maximum Width'|@translate}"; +var labelWidth = "{'Width'|@translate}"; + +var labelMaxHeight = "{'Maximum Height'|@translate}"; +var labelHeight = "{'Height'|@translate}"; +{literal} jQuery(document).ready(function(){ - function toggleResizeFields(prefix) { - var checkbox = jQuery("#"+prefix+"_resize"); - var needToggle = jQuery("input[name^="+prefix+"_]").not(checkbox).parents('tr'); + function toggleResizeFields(size) { + var checkbox = jQuery("#original_resize"); + var needToggle = jQuery("#sizeEdit-original"); if (jQuery(checkbox).is(':checked')) { needToggle.show(); @@ -284,17 +290,58 @@ jQuery(document).ready(function(){ toggleResizeFields("original"); jQuery("#original_resize").click(function () {toggleResizeFields("original")}); + + jQuery("a[id^='sizeEditOpen-']").click(function(){ + var sizeName = jQuery(this).attr("id").split("-")[1]; + jQuery("#sizeEdit-"+sizeName).toggle(); + jQuery(this).hide(); + }); + + jQuery(".cropToggle").click(function() { + var labelBoxWidth = jQuery(this).parents('table.sizeEditForm').find('td.sizeEditWidth'); + var labelBoxHeight = jQuery(this).parents('table.sizeEditForm').find('td.sizeEditHeight'); + + if (jQuery(this).is(':checked')) { + jQuery(labelBoxWidth).html(labelWidth); + jQuery(labelBoxHeight).html(labelHeight); + } + else { + jQuery(labelBoxWidth).html(labelMaxWidth); + jQuery(labelBoxHeight).html(labelMaxHeight); + } + }); + + jQuery("#showDetails").click(function() { + jQuery(".sizeDetails").show(); + jQuery(this).css("visibility", "hidden"); + }); + }); {/literal}{/footer_script} +{literal} + +{/literal} +