In Thomas's wonderful code snippet below, the second parameter needs to be changed to "$filename", otherwise the script has no write the file. So the code should read:
<?php
function remove_XMP($image_in, $filename) {
$filename_in = addslashes($image_in);
list($width, $height) = getimagesize($filename_in);
$image_dest = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($filename_in);
imagecopyresampled($image_dest, $image, 0, 0, 0, 0, $width, $height,$width, $height);
imagejpeg($image_dest, $filename);
}
?>