jeudi 26 février 2015

How to continue a php script after using exit() / die()

For example i have the following script.


in this case i want to get the value of X1 and Y1 but the the exit() is not letting me to do so


please help thanks in advance and special thanks to Mark Setchell :P (if he sees this)


image link



$im = imagecreatefromjpeg("omr.jpg");
for($x=0;$x<100;$x++) {

for($y=0;$y<100;$y++)
{

$rgb = imagecolorat($im,$x,$y);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
if($r<128 && $g<128 && $b<128){
printf("%d,%d: %d,%d,%d\n",$x,$y,$r,$g,$b);
exit;
}
}
}

for($x1=1170;$x1<1270;$x1++){

for($y1=0;$y1<100;$y1++){

$rgb = imagecolorat($im,$x1,$y1);

$r1 = ($rgb >> 16) & 0xFF;
$g1 = ($rgb >> 8) & 0xFF;
$b1 = $rgb & 0xFF;
if($r1<128 && $g1<128 && $b1<128){
printf("%d,%d: %d,%d,%d\n",$x1,$y1,$r1,$g1,$b1);
exit;
}
}
}



current output : 30,53: 123,119,118


Desired output : 30,53: 123,119,118


1217,55: 115,114,112



Aucun commentaire:

Enregistrer un commentaire