rendered paste body<?php
//var_dump(gd_info());
?>
<?
//screen resolution 1280 x 768
//PNG blue is 056147
function png_pixel($img, $x, $y) {
if (!file_exists($img)) return -1;
$image=imageCreateFromPNG($img);
$colorindex = imagecolorat($image,$x,$y);
$colorrgb = imagecolorsforindex($image,$colorindex);
//echo "RGB values of the pixel at position $x - $y in $img are: ".$colorrgb['red'] . $colorrgb['green'] . $colorrgb['blue'] . "\n Apha value is: ".$colorrgb['alpha'];
return $colorrgb['red'] . $colorrgb['green'] . $colorrgb['blue'];
}
$alertimg = "c:\alertimg.PNG";
$pix = png_pixel($alertimg, 250, 400);
echo "Scanned screenshot and got pixel #$pix\n\n";
if ($pix == "056147"){
exec("start sndrec32 /play /close \"c:\windows\media\chord.wav\" ");
echo "ALERT";
}elseif ($pix == -1) {
echo "\nImage not found!";
}else{
echo "\nNo new alert, exiting.";
}
// JPEG blue is 357143 ??
die;
function jpeg_pixel($img, $x, $y) {
$image=imageCreateFromJPEG($img);
//$x = 10;
//$y = 15;
$colorindex = imagecolorat($image,$x,$y);
$colorrgb = imagecolorsforindex($image,$colorindex);
echo "RGB values of the pixel at position $x - $y in $img are: ".$colorrgb['red'] . $colorrgb['green'] . $colorrgb['blue'] . "\n Apha value is: ".$colorrgb['alpha'];
//return $colorrgb;
}
function png_pixel_old($img, $x, $y) {
$image=imageCreateFromPNG($img);
//$x = 10;
//$y = 15;
$colorindex = imagecolorat($image,$x,$y);
$colorrgb = imagecolorsforindex($image,$colorindex);
echo "RGB values of the pixel at position $x - $y in $img are: ".$colorrgb['red'] . $colorrgb['green'] . $colorrgb['blue'] . "\n Apha value is: ".$colorrgb['alpha'];
//return $colorrgb;
}
$colorrgb = jpeg_pixel('c:\alertban.jpg', 1, 1);
$colorrgb = jpeg_pixel('c:\image.jpg', 1, 1);
$colorrgb = png_pixel('c:\alertimg.PNG', 250, 400);
$colorrgb = png_pixel('c:\alertban.PNG', 5, 5);
//echo "RGB values of the pixel at position $x - $y are: ".$colorrgb['red'] . $colorrgb['green'] . $colorrgb['blue'] . "\n Apha value is: ".$colorrgb['alpha'];
?>