mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
feature:2388
on element_set_ranks, no more clipping due to the use of the default square size git-svn-id: http://piwigo.org/svn/trunk@14205 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -214,7 +214,6 @@ if (pwg_db_num_rows($result) > 0)
|
|||||||
{
|
{
|
||||||
$derivative = new DerivativeImage($derivativeParams, new SrcImage($row));
|
$derivative = new DerivativeImage($derivativeParams, new SrcImage($row));
|
||||||
|
|
||||||
$thumbnail_size = $derivative->get_size();
|
|
||||||
if ( !empty( $row['name'] ) )
|
if ( !empty( $row['name'] ) )
|
||||||
{
|
{
|
||||||
$thumbnail_name = $row['name'];
|
$thumbnail_name = $row['name'];
|
||||||
@@ -224,42 +223,15 @@ if (pwg_db_num_rows($result) > 0)
|
|||||||
$file_wo_ext = get_filename_wo_extension($row['file']);
|
$file_wo_ext = get_filename_wo_extension($row['file']);
|
||||||
$thumbnail_name = str_replace('_', ' ', $file_wo_ext);
|
$thumbnail_name = str_replace('_', ' ', $file_wo_ext);
|
||||||
}
|
}
|
||||||
$thumbnail_info[] = array(
|
|
||||||
'name' => $thumbnail_name,
|
|
||||||
'width' => $thumbnail_size[0],
|
|
||||||
'height' => $thumbnail_size[1],
|
|
||||||
'id' => $row['id'],
|
|
||||||
'tn_src' => $derivative->get_url(),
|
|
||||||
'rank' => $current_rank * 10,
|
|
||||||
);
|
|
||||||
if ($thumbnail_size[0]<=128 and $thumbnail_size[1]<=128)
|
|
||||||
{
|
|
||||||
$clipping[]= min($thumbnail_size[0],$thumbnail_size[1]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$clipping[]= min($thumbnail_size[0]*0.75,$thumbnail_size[1]*0.75);
|
|
||||||
}
|
|
||||||
$current_rank++;
|
$current_rank++;
|
||||||
}
|
|
||||||
$clipping=array_sum($clipping)/count($clipping);
|
|
||||||
foreach ($thumbnail_info as $thumbnails_info)
|
|
||||||
{
|
|
||||||
$thumbnail_x_center = $thumbnails_info['width']/2;
|
|
||||||
$thumbnail_y_center = $thumbnails_info['height']/2;
|
|
||||||
$template->append(
|
$template->append(
|
||||||
'thumbnails',
|
'thumbnails',
|
||||||
array(
|
array(
|
||||||
'ID' => $thumbnails_info['id'],
|
'ID' => $row['id'],
|
||||||
'NAME' => $thumbnails_info['name'],
|
'NAME' => $thumbnail_name,
|
||||||
'TN_SRC' => $thumbnails_info['tn_src'],
|
'TN_SRC' => $derivative->get_url(),
|
||||||
'RANK' => $thumbnails_info['rank'],
|
'RANK' => $current_rank * 10,
|
||||||
'CLIPING' => round($clipping),
|
'SIZE' => $derivative->get_size(),
|
||||||
'CLIPING_li' => round($clipping+8),
|
|
||||||
'CLIP_TOP' => round($thumbnail_y_center - $clipping/2),
|
|
||||||
'CLIP_RIGHT' => round($thumbnail_x_center + $clipping/2),
|
|
||||||
'CLIP_BOTTOM' => round($thumbnail_y_center + $clipping/2),
|
|
||||||
'CLIP_LEFT' => round($thumbnail_x_center - $clipping/2)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,12 +50,8 @@ jQuery('.clipwrapper').tipTip({
|
|||||||
<p>{'Drag to re-order'|@translate}</p>
|
<p>{'Drag to re-order'|@translate}</p>
|
||||||
<ul class="thumbnails">
|
<ul class="thumbnails">
|
||||||
{foreach from=$thumbnails item=thumbnail}
|
{foreach from=$thumbnails item=thumbnail}
|
||||||
<li class="rank-of-image" style="width:{$thumbnail.CLIPING_li}px; height:{$thumbnail.CLIPING_li}px; ">
|
<li class="rank-of-image">
|
||||||
<div class="clipwrapper" style="width:{$thumbnail.CLIPING}px; height:{$thumbnail.CLIPING}px; " title="{$thumbnail.NAME|@replace:'"':' '}">
|
<img src="{$thumbnail.TN_SRC}" class="thumbnail" alt="{$thumbnail.NAME|@replace:'"':' '}" style="width:{$thumbnail.SIZE[0]}px; height:{$thumbnail.SIZE[1]}px; ">
|
||||||
<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">
|
|
||||||
<img src="{$thumbnail.TN_SRC}" class="thumbnail" alt="{$thumbnail.NAME|@replace:'"':' '}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<input type="text" name="rank_of_image[{$thumbnail.ID}]" value="{$thumbnail.RANK}" style="display:none">
|
<input type="text" name="rank_of_image[{$thumbnail.ID}]" value="{$thumbnail.RANK}" style="display:none">
|
||||||
</li>
|
</li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
|
|||||||
Reference in New Issue
Block a user