[eluser]Agung Wahyudiono[/eluser]
Code:
[removed]
<?php if(isset($ratio) && isset($orig_w) && isset($orig_h) && isset($target_w) && isset($target_h)): ?>
$(function(){
$('#cropbox').Jcrop({
aspectRatio: <?php echo $ratio ?>,
setSelect: [0,0,<?php echo $orig_w.','.$orig_h;?>],
onSelect: updateCoords,
onChange: updateCoords
});
});
function updateCoords(c)
{
showPreview(c);
$("#x").val(c.x);
$("#y").val(c.y);
$("#w").val(c.w);
$("#h").val(c.h);
}
function showPreview(coords)
{
var rx = <?php echo $target_w;?> / coords.w;
var ry = <?php echo $target_h;?> / coords.h;
$("#preview img").css({
width: Math.round(rx*<?php echo $orig_w;?>)+'px',
height: Math.round(ry*<?php echo $orig_h;?>)+'px',
marginLeft:'-'+ Math.round(rx*coords.x)+'px',
marginTop: '-'+ Math.round(ry*coords.y)+'px'
});
}
function limiter(textid, limit, infodiv){
var text = $("#"+textid).val();
var textlength = text.length;
if (textlength > limit) {
$("#"+infodiv).html("You cannot write more then "+limit+" characters!");
$("#"+textid).val(text.substr(0,limit));
return false;
} else {
$("#"+infodiv).html("You have "+(limit - textlength)+" character left !");
return true;
}
};
$(document).ready(function(){
$(function(){$("#fdesc").keyup(function(){limiter("fdesc","150","finfo")})});
});
<?php endif; ?>
[removed]
<style type="text/css">
#preview
{
width: <?php echo $target_w?>px;
height: <?php echo $target_h?>px;
overflow:hidden;
}
</style>
<div id="containerHolder">
<div id="container">
<div id="sidebar">
<ul class="sideNav">
<li><?php echo anchor('djawaadmin/feature/list','List') ?></li>
<li><?php echo anchor('djawaadmin/feature/upload','Upload','class="active"') ?></li>
</ul>
<!-- // .sideNav -->
</div>
<!-- // #sidebar -->
<!-- h2 stays for breadcrumbs -->
<div id="main" style="padding-bottom:10px;">
<h3>Upload Picture for Feature</h3>
<?php if(isset($status)){echo $status;}?>
<?php if(isset($error_notification)){echo $error_notification.'<br /><br />';}?>
<?php if(isset($thepicture)){echo '<div class="imageborder">Original Picture <br /><br /><img src="'.$thepicture.'" id="cropbox" alt="cropbox"></div>';} ?>
<?php if(isset($thepicture)){echo '<div style="clear:both; margin-bottom:20px;"></div>';} ?>
<?php
if(isset($thepicture)){
echo '
<div class="imageborder" align="center">
Image Preview for Feature ( Fixed Size 600 x 400 px ) <br /><br />
<div id="preview"><img src="'.$thepicture.'" alt="thumb"></div>
</div><br /><br />';
}
?>
<?php if(isset($form)){echo $form;} ?>
</div>
<!-- // #main -->
<div class="clear"></div>
</div>
<!-- // #container -->
</div>
<!-- // #containerHolder -->
and This is for the view.
At Last iwll say...
This library has alot of weaknes , so I want you to give contribution for this library.
Thanks