I++Вот так)
<form method="post" enctype="multipart/form-data">
<input type="file" name="image"><br>
<input type="submit" name="btn">
</form>
<?php
set_time_limit(180);
include 'lib.php';
if(isset($_POST['btn'])){
$im = imagecreatefromjpeg($_FILES['image']['tmp_name']);
<pre></pre>
imagefilter($im,IMG_FILTER_GRAYSCALE);
for($pix=10;$pix<=80;$pix++){
$res='';
for($i=0;$i<=imagesx($im)-1;$i++){
$rgb = imageColorAt($im, $i, imagesy($im)/2);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
<br>
if($r<$pix && $g<$pix && $b<$pix) $res.='1';
else $res.='0';
}
$res=preg_replace('/^[0]+|[0]+$/','',$res);
preg_match_all('/[0]+|[1]+/',$res,$res2);
$str_s=strlen($res2[0][0]);
for($zze=0;$zze<=10;$zze++){
$str_g=round($str_s/2)+$zze;
for($show=0;$show<count($res2[0]);$show++){
$result[0][$show]=substr($res2[0][$show],0, round(strlen($res2[0][$show])/$str_g));
}
$check1=$result[0][0].$result[0][1].$result[0][2];
if(preg_match('/^11000011/',$check1) && preg_match('/11000011$/',implode('',$result[0]))){
<br>
$res_show=implode('',$result[0]);
deconvert($res_show);
break;
}
else 'Резузьтат плохой!!! <br>'.deconvert(implode('',$result[0]));
if(isset($s)) break;
}
if(isset($s)) break;
}
}
imagepng($im,'hard_test.png');
?>