Changeset 9864


Ignore:
Timestamp:
Mar 26, 2011, 3:29:27 PM (10 years ago)
Author:
flop25
Message:

feature:2230
the size of the squared thumbnails depend of the sizes of all the thumbnails : the clipping is an average of the clipping of each of the thumbnails

Location:
trunk/admin
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/element_set_ranks.php

    r9051 r9864  
    210210// template thumbnail initialization
    211211$current_rank = 1;
    212 
     212$thumbnail_info=array();
     213$clipping=array();
    213214while ($row = pwg_db_fetch_assoc($result))
    214215{
    215216  $src = get_thumbnail_url($row);
    216 
    217   list($thumbnail_width, $thumbnail_height) = getimagesize($src);
    218   $thumbnail_x_center = $thumbnail_width/2;
    219   $thumbnail_y_center = $thumbnail_height/2;
    220  
     217       
     218        $thumbnail_size = getimagesize($src);
     219        $thumbnail_info[] = array(
     220                'width' => $thumbnail_size[0],
     221                'height'        => $thumbnail_size[1],
     222                'id'    => $row['id'],
     223                'tn_src'        => $src,
     224                'rank'  => $current_rank * 10,
     225                );
     226        $clipping[]= min($thumbnail_size[0]*0.75,$thumbnail_size[1]*0.75);
     227
     228  $current_rank++;
     229}
     230$clipping=array_sum($clipping)/count($clipping);
     231foreach ($thumbnail_info as $thumbnails_info)
     232{
     233  $thumbnail_x_center = $thumbnails_info['width']/2;
     234  $thumbnail_y_center = $thumbnails_info['height']/2;
    221235  $template->append(
    222236    'thumbnails',
    223237    array(
    224       'ID' => $row['id'],
    225       'TN_SRC' => $src,
    226       'RANK' => $current_rank * 10,
    227       'CLIP_TOP' => round($thumbnail_y_center - 96/2),
    228       'CLIP_RIGHT' => round($thumbnail_x_center + 96/2),
    229       'CLIP_BOTTOM' => round($thumbnail_y_center + 96/2),
    230       'CLIP_LEFT' => round($thumbnail_x_center - 96/2)
     238      'ID' => $thumbnails_info['id'],
     239      'TN_SRC' => $thumbnails_info['tn_src'],
     240      'RANK' => $thumbnails_info['rank'],
     241      'CLIPING' => round($clipping),
     242      'CLIPING_li' => round($clipping+8),
     243      'CLIP_TOP' => round($thumbnail_y_center - $clipping/2),
     244      'CLIP_RIGHT' => round($thumbnail_x_center + $clipping/2),
     245      'CLIP_BOTTOM' => round($thumbnail_y_center + $clipping/2),
     246      'CLIP_LEFT' => round($thumbnail_x_center - $clipping/2)
    231247      )
    232248    );
    233 
    234   $current_rank++;
    235 }
    236 
     249}
    237250// image order management
    238251$sort_fields = array(
  • trunk/admin/themes/default/fix-ie7.css

    r9348 r9864  
    33#menubar { margin: 0; }
    44#footer { left: 0; }
     5
     6UL.thumbnails li.rank-of-image {
     7        text-align:left;
     8}
  • trunk/admin/themes/default/template/element_set_ranks.tpl

    r9586 r9864  
    4444    <ul class="thumbnails">
    4545      {foreach from=$thumbnails item=thumbnail}
    46       <li class="rank-of-image">
    47         <div class="clipwrapper">
     46      <li class="rank-of-image" style="width:{$thumbnail.CLIPING_li}px; height:{$thumbnail.CLIPING_li}px; ">
     47        <div class="clipwrapper" style="width:{$thumbnail.CLIPING}px; height:{$thumbnail.CLIPING}px; ">
    4848          <div class="clip" style="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">
    4949            <img src="{$thumbnail.TN_SRC}" class="thumbnail" alt="">
  • trunk/admin/themes/default/theme.css

    r9815 r9864  
    5555  width: 96px;
    5656  height: 96px;
     57  margin: 3px;
    5758}
    5859.clip {
Note: See TracChangeset for help on using the changeset viewer.