source: extensions/square_thumbnails/thumbnail.php @ 6299

Last change on this file since 6299 was 5962, checked in by patdenice, 14 years ago

Square option is available for thumbnail creation page and upload form.

File size: 1.4 KB
RevLine 
[5943]1<?php
2
[5962]3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
[5943]4
[5962]5global $template;
[5943]6
[5962]7load_language('plugin.lang', SQUARE_THUMB_PATH);
[5943]8
[5962]9// Add handler for square resize
10if (isset($_POST['square']))
[5943]11{
[5962]12  include(SQUARE_THUMB_PATH.'functions.inc.php');
[5943]13}
14
[5962]15// Add prefilter
16$template->set_prefilter('thumbnail', 'add_square_option');
[5943]17
[5962]18function add_square_option($content, $smarty)
[5943]19{
[5962]20  $search = '<li>
21        <span class="property">
22          <label for="width">{\'maximum width\'|@translate}</label>';
[5943]23
[5962]24  $replacement = '
25{html_head}
26{literal}
27<script type="text/javascript">
28jQuery().ready(function(){
29  jQuery(":text").keyup(function(){
30    if(jQuery("#square").attr("checked")){
31      if (this.id == "width"){
32        jQuery("#height").attr("value", this.value);
33      }else{
34        jQuery("#width").attr("value", this.value);
[5943]35      }
36    }
[5962]37  });
38  jQuery("#square").click(function(){
39    if (this.checked)
40      jQuery("#height").attr("value", jQuery("#width").attr("value"));
41  });
42});
43</script>
44{/literal}
45{/html_head}
[5943]46
[5962]47      <li>
48        <span class="property">{\'Square Thumbnails\'|@translate}</span>
49             <label><input type="checkbox" name="square" id="square" {if $params.SQUARE}checked="checked"{/if}></label>
50      </li>
[5943]51
[5962]52      <li>
53        <span class="property">
54          <label for="width">{\'maximum width\'|@translate}</label>';
[5943]55
[5962]56  return str_replace($search, $replacement, $content);
[5943]57}
58
[5962]59?>
Note: See TracBrowser for help on using the repository browser.