* Finish task #9023.
This commit is contained in:
@@ -11,31 +11,41 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="img-cutter fixed-ratio" id="imgCutter" style="max-width: 100%">
|
||||
<div class="canvas">
|
||||
<?php
|
||||
if(empty($user->avatar))
|
||||
{
|
||||
echo html::image($image->webPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo html::image($user->avatar);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<h5 id='avatarCropTip'><?php echo $lang->user->cropAvatarTip;?></h5>
|
||||
<div class="img-cutter-preview"></div>
|
||||
<button type="button" class="btn btn-primary img-cutter-submit"><?php echo $lang->save;?></button> <?php echo html::a(inlink('profile'), $lang->goback, "class='btn loadInModal'");?>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<script> /*! TangBin: image.ready.js http://www.planeart.cn/?p=1121 */ !function(n){"use strict";n.zui.imgReady=function(){var n=[],l=null,e=function(){for(var l=0;l<n.length;l++)n[l].end?n.splice(l--,1):n[l]();!n.length&&o()},o=function(){clearInterval(l),l=null};return function(o,r,t,u){var c,i,a,d,f,h=new Image;return h.src=o,h.complete?(r.call(h),void(t&&t.call(h))):(i=h.width,a=h.height,h.onerror=function(){u&&u.call(h),c.end=!0,h=h.onload=h.onerror=null},c=function(){d=h.width,f=h.height,(d!==i||f!==a||d*f>1024)&&(r.call(h),c.end=!0)},c(),h.onload=function(){!c.end&&c(),t&&t.call(h),h=h.onload=h.onerror=null},void(c.end||(n.push(c),null===l&&(l=setInterval(e,40)))))}}()}(jQuery); </script>
|
||||
<?php js::import($this->app->getWebRoot() . 'js/zui/imgcutter/min.js');?>
|
||||
<?php css::import($this->app->getWebRoot() . 'js/zui/imgcutter/min.css');?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php echo $lang->user->cropAvatar;?></h2>
|
||||
</div>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="img-cutter fixed-ratio" id="imgCutter" style="max-width: 100%">
|
||||
<div class="canvas">
|
||||
<?php
|
||||
if(empty($user->avatar))
|
||||
{
|
||||
echo html::image($image->webPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
echo html::image($user->avatar);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<h5 id='avatarCropTip'><?php echo $lang->user->cropAvatarTip;?></h5>
|
||||
<div class="img-cutter-preview"></div>
|
||||
<button type="button" class="btn btn-primary img-cutter-submit"><?php echo $lang->save;?></button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var $imgCutter = $("#imgCutter");
|
||||
$imgCutter.imgCutter(
|
||||
@@ -44,12 +54,12 @@ $imgCutter.imgCutter(
|
||||
minWidth: 48,
|
||||
minHeight: 48,
|
||||
post: '<?php echo inlink('cropavatar', "image={$image->id}")?>',
|
||||
ready: function() {$.zui.ajustModalPosition(); $imgCutter.css('width', $imgCutter.closest('.modal-dialog').width() - 50);},
|
||||
ready: function() {$.zui.ajustModalPosition(); $imgCutter.css('width', $imgCutter.closest('#mainContent').width());},
|
||||
done: function(response)
|
||||
{
|
||||
$('#start .avatar, #startMenu .avatar').html('<img src="<?php echo $user->avatar?>?v=' + $.zui.uuid() + '" />');
|
||||
if($('#start .avatar, #startMenu .avatar').hasClass('with-text')) $('#start .avatar, #startMenu .avatar').toggleClass('with-text').css('background', 'none');
|
||||
$('#ajaxModal').load(createLink('user', 'profile'), function(){$.zui.ajustModalPosition()});
|
||||
location.href = createLink('my', 'profile');
|
||||
},
|
||||
onSizeError: function(size)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user