So I wrote my own DPI function for PHP that rather than doing pointless resampling simply adjusts the file header.
My needs didn't require me to do it "right", but it will handle from 1 to 255 DPI.
@$jpg -- Path to a jpg file
@$dpi -- DPI to use (1-255)
function set_dpi($jpg, $dpi = 163)
$fr = fopen($jpg, 'rb');
$fw = fopen("$jpg.temp", 'wb');
fwrite($fw, fread($fr, 13) . chr(1) . chr(0) . chr($dpi) . chr(0) . chr($dpi));