É usado para extrair uma certa parte de uma imagem para criar uma nova imagem.
$render=explode(" ",$_POST["partial_render"]);
$name = rand(1000,99999);
$coords = explode("_", $_POST["original_coords"]);
$targ_w = $coords[2];
$targ_h = $coords[3];
$jpeg_quality = 90;
$src = "../../../resource/demo/images/nature/nature6.jpg";
$img_r = imagecreatefromjpeg($src);
$dst_r = ImageCreateTrueColor( $targ_w, $targ_h );
imagecopyresampled($dst_r,$img_r,0,0,$coords[0],$coords[1],$targ_w,$targ_h,$coords[2],$coords[3]);
$image="../../../resource/demo/images/crop/".$name.".jpg";
imagejpeg($dst_r,$image,$jpeg_quality);
$resposta1="
<span id="alerta" class="ui-growl-pl" data-widget="widget_alerta" data-summary="data-summary" data-detail="data-detail" data-severity="all,error" data-redisplay="true"></span>
<script id="alerta_s" type="text/javascript">
DinarteCoelho.cw("Growl", "widget_alerta", {
id: "alerta",
sticky: false,
life: 6000,
escape: true,
keepAlive: false,
msgs: [{
summary: "Sucesso",
detail: "Corte finalizado.",
severity: "info",
severityText: "Information"
}]
});
</script>
";
$resposta="<span id="cropped"><img src="/sistema/resource/demo/images/crop/".$name.".jpg" alt="" /></span>";
dc.cw("Growl", "widget_alerta", {
id: "alerta"
, sticky: false
, life: 6000
, escape: true
, keepAlive: false
, msgs: []
});
DinarteCoelho.onElementLoad($(DinarteCoelho.escapeClientId("original_image")), function () {
dc.cw("ImageCropper", "widget_original", {
id: "original"
, image: "original_image"
, viewMode: 1
, zoomOnWheel: false
, minSize: [100, 100]
, maxSize: [250, 250]
, initialCoords: [225, 75, 300, 125]
});
});
dc.cw("CommandButton", "widget_BtnCortar", {
id: "BtnCortar"
});