Ignore:
Timestamp:
Mar 26, 2011, 3:29:27 PM (13 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

File:
1 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(
Note: See TracChangeset for help on using the changeset viewer.