Pode carregar a imagem dinamicamente usando recursos do Servidor.
$render=explode(" ",$_POST["partial_render"]);
$v=$_POST["iterationSpinner_input"];
if($render[0]=="streamed_cropper"){
$resposta="<div id="streamed_cropper"><img id="streamed_cropper_image" alt="" src="/sistema/resource/images/dynamiccontent.php?v=".$v."" height="auto" width="100%" style="max-width: 100%;" /><input id="streamed_cropper_coords" name="streamed_cropper_coords" type="hidden" autocomplete="off" aria-hidden="true" /></div>";
$eval="DinarteCoelho.onElementLoad($(DinarteCoelho.escapeClientId("streamed_cropper_image")), function () {
dc.cw("ImageCropper", "widget_streamed_cropper", {
id: "streamed_cropper"
, image: "streamed_cropper_image"
, viewMode: 1
, minSize: [50, 50]
, maxSize: [350, 350]
, initialCoords: [203, 56, 282, 108]
});
});";
}else{
$T1 = 20;
$T2 = $v;
$myImage = @imagecreatetruecolor(640, 480)
or die("Não é possível inicializar o novo fluxo de imagem GD");
$text_color = imagecolorallocate($myImage, 255, 255, 224);
$poly_color = imagecolorallocate($myImage, 124, 120, 224);
$points = array();
for ($i=0; $i<1000; $i=$i+1)
{
$x = 310*cos($i/$T1);
$y = 230*sin($i/$T2);
$points[] = 320+$x;
$points[] = 240-$y;
}
$totalPoints = count($points)/2;
$title = "Final Plotado ($totalPoints pontos)";
imagestring($myImage, 3, 5, 5, $title, $text_color);
for ($i=0; $i<$totalPoints-1; $i++)
{
imageLine($myImage, $points[2*$i], $points[1+2*$i], $points[2+2*$i], $points[3+2*$i], $poly_color);
}
$name = rand(1000,99999);
$coords = explode("_", $_POST["streamed_cropper_coords"]);
$targ_w = $coords[2];
$targ_h = $coords[3];
$jpeg_quality = 90;
$dst_r = ImageCreateTrueColor($targ_w, $targ_h);
imagecopyresampled($dst_r,$myImage,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: []
});
dc.cw("Spinner", "widget_iterationSpinner", {
id: "iterationSpinner"
, step: 5.0
, min: 5.0
, max: 50.0
, decimalPlaces: "0"
, thousandSeparator: ","
, decimalSeparator: "."
});
DinarteCoelho.onElementLoad($(DinarteCoelho.escapeClientId("streamed_cropper_image")), function () {
dc.cw("ImageCropper", "widget_streamed_cropper", {
id: "streamed_cropper"
, image: "streamed_cropper_image"
, viewMode: 1
, minSize: [50, 50]
, maxSize: [350, 350]
, initialCoords: [203, 56, 282, 108]
});
});
dc.cw("CommandButton", "widget_BtnCortar", {
id: "BtnCortar"
});