Вот способ работает на все 100:
Создаем два php файла 1.php и 2.php1.php :function show_grayscale($filename){
$img_size = GetImageSize($filename);
$width = $img_size[0];
$height = $img_size[1];
$img = imageCreate($width,$height);
for ($c = 0; $c < 256; $c++) {
ImageColorAllocate($img, $c,$c,$c);
}
$img2 = ImageCreateFromJpeg($filename);
ImageCopyMerge($img,$img2,0,0,0,0, $width, $height, 100);
header("Content-type: image/jpeg");
imagejpeg($img);
imagedestroy($img);
}
echo $mim = show_grayscale("77.jpeg");2.php :echo '<script type="text/javascript">
function chen_sec()
{
document.images.myimage.src = "77.jpeg";
}
function chen_fir()
{
document.images.myimage.src = "1.php";
}
</script>';
echo '<img id="myimage" src="1.php" onmouseover="chen_sec()" onmouseout="chen_fir()" />';
Файл 1.php делает изображение черно-белым, а файл 2.php совершает подмену.