Changeset 3792


Ignore:
Timestamp:
Aug 24, 2009, 10:25:58 PM (11 years ago)
Author:
nikrou
Message:

Generate square thumbnails (css clip)
Allow admin to define thumbnail size

Location:
extensions/akBookStyle/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • extensions/akBookStyle/trunk/admin.php

    r3791 r3792  
    3737  }
    3838
     39  if (!empty($_POST['ak_thumbnail_size']) && intval($_POST['ak_thumbnail_size'])!=$me->ak_thumbnail_size) {
     40    $me->ak_thumbnail_size = intval($_POST['ak_thumbnail_size']);
     41    array_push($GLOBALS['page']['infos'], $lang['ak_thumbnail_size_changed']);
     42    $save_config = true;
     43  }
     44
    3945  if ($save_config) {
    4046    $me->save_config();
     
    4551$GLOBALS['template']->assign('AK_PLUGIN_CSS', AK_PLUGIN_CSS);
    4652$GLOBALS['template']->assign('AK_BY_LINE', $me->ak_by_line);
     53$GLOBALS['template']->assign('AK_THUMBNAIL_SIZE', $me->ak_thumbnail_size);
    4754$GLOBALS['template']->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
    4855?>
  • extensions/akBookStyle/trunk/default_values.inc.php

    r3791 r3792  
    2626
    2727$default_values['ak_by_line'] = 2;
     28$default_values['ak_thumbnail_size'] = 100;
    2829?>
  • extensions/akBookStyle/trunk/include/akContent.class.php

    r3791 r3792  
    4848    $template->assign('AK_PLUGIN_JS', AK_PLUGIN_JS);
    4949
    50     $template->assign('AK_DIR_THUMBNAIL', $GLOBALS['conf']['dir_thumbnail']);
     50    $template->assign('AK_DIR_THUMBNAIL', isset($GLOBALS['conf']['dir_thumbnail'])?$GLOBALS['conf']['dir_thumbnail']:'thumbnail');
    5151    $template->assign('AK_PREFIX_THUMBNAIL', $GLOBALS['conf']['prefix_thumbnail']);
    5252    $template->assign('AK_PIC_SRC', get_image_url($images[$this->current_picture]));
    5353    $template->assign('AK_BY_LINE', $this->plugin_config->ak_by_line);
     54    $template->assign('AK_THUMBNAIL_SIZE', $this->plugin_config->ak_thumbnail_size);
    5455    $template->assign('AK_RELOADED_IMAGE_TPL', AK_PLUGIN_TEMPLATE. '/ak_reloaded_image.tpl');
    5556  }
     
    5859  public function loc_end_index_thumbnails($tpl_vars, $images) {
    5960    foreach ($tpl_vars as &$tpl_var) {
     61      $tpl_var['AK_URL'] = $this->makeAkUrl($tpl_var);
    6062
    61       $tpl_var['AK_URL'] = $this->makeAkUrl($tpl_var);
     63      list($thumbnail_width, $thumbnail_height) = getimagesize($tpl_var['TN_SRC']);
     64      $thumbnail_x_center = $thumbnail_width/2;
     65      $thumbnail_y_center = $thumbnail_height/2;
     66      $tpl_var['CLIP_TOP'] = round($thumbnail_y_center - $this->plugin_config->ak_thumbnail_size/2);
     67      $tpl_var['CLIP_RIGHT'] = round($thumbnail_x_center + $this->plugin_config->ak_thumbnail_size/2);
     68      $tpl_var['CLIP_BOTTOM'] = round($thumbnail_y_center + $this->plugin_config->ak_thumbnail_size/2);
     69      $tpl_var['CLIP_LEFT'] = round($thumbnail_x_center - $this->plugin_config->ak_thumbnail_size/2);
    6270    }
    6371
  • extensions/akBookStyle/trunk/language/en_UK/plugin.lang.php

    r3791 r3792  
    88$lang['ak_by_line'] = "Number of column";
    99$lang['ak_by_line_changed'] = "Number of column has been updated";
     10$lang['ak_thumbnail_size'] = "Thumbnail size";
     11$lang['ak_by_line_changed'] = "Thumbnail size has been updated";
    1012?>
  • extensions/akBookStyle/trunk/language/fr_FR/plugin.lang.php

    r3791 r3792  
    88$lang['ak_by_line'] = "Nombre de colonnes";
    99$lang['ak_by_line_changed'] = "Le nombre de colonne a été mis à jour";
    10 
     10$lang['ak_thumbnail_size'] = "Taille des imagettes";
     11$lang['ak_by_line_changed'] = "La taille des imagette a été mis à jour";
    1112?>
  • extensions/akBookStyle/trunk/template/admin.tpl

    r3791 r3792  
    1919    </label>
    2020  </p>
     21  <p class="field">
     22    <label>{'ak_thumbnail_size'|@translate}
     23      <input type="text" name="ak_thumbnail_size" value="{$AK_THUMBNAIL_SIZE}">
     24    </label>
     25  </p>
    2126</fieldset>
    2227
  • extensions/akBookStyle/trunk/template/ak_thumbnails.tpl

    r3791 r3792  
    3535          {/if}
    3636          <td class="ncol">
    37             <a href="{$thumbnail.AK_URL}" class="load">
    38               <img class="thumbnail" src="{$thumbnail.TN_SRC}"
    39              alt="{$thumbnail.TN_ALT}" title="{$thumbnail.TN_TITLE}">
    40             </a>
     37            <div style="position:relative;width:{$AK_THUMBNAIL_SIZE}px;height:{$AK_THUMBNAIL_SIZE}px">
     38              <div style="position:absolute;clip:rect({$thumbnail.CLIP_TOP}px {$thumbnail.CLIP_RIGHT}px {$thumbnail.CLIP_BOTTOM}px {$thumbnail.CLIP_LEFT}px);top:-{$thumbnail.CLIP_TOP}px;left:-{$thumbnail.CLIP_LEFT}px">
     39                <a href="{$thumbnail.AK_URL}" class="load">
     40                  <img class="thumbnail" src="{$thumbnail.TN_SRC}"
     41                       alt="{$thumbnail.TN_ALT}" title="{$thumbnail.TN_TITLE}">
     42                </a>
     43              </div>
     44            </div>
    4145          </td>
    4246        {if ($smarty.foreach.tn.iteration % $AK_BY_LINE == 0) or $smarty.foreach.tn.last }
Note: See TracChangeset for help on using the changeset viewer.