you want to iterate through the image pixel by pixel and then imagecopymerge a sampling over a plain white base
PHP Code:
<?php
$resource = 'whatever.jpg';
$opacity = 20;
$siz = getimagesize($resource);
$basei = imagecreatefromjpeg($resource);
$newi = imagecreatetruecolor($siz[0],$siz[1]);
$whit = imagecolorallocate($newi, 255, 255, 255);
for($dy = 0; $dy < $siz[1]; $dy++)
{
for($dx = 0; $dx < $siz[0]; $dx++)
{
imagecopymerge($newi, $basei, $dx, $dy, $dx, $dy, 1, 1, $opacity);
}
}
imagedestroy($basei);
imagejpeg($newi, 'folder/save.jpg', 85);
imagedestroy($newi);
?>
fly typed so will probably parse bad, should point you in the right direction though.
subnote - GD2 functions used.
-------------
edit - you wouldn't need to iterate really - lose the for loops and just use
imagecopymerge($newi, $basei, 0, 0, 0, 0, $siz[0], $siz[1], $opacity);