After a few days of trying different solutions and doing some more research,
this is what I found worked for me.
$image = imagecreatefromjpeg( 'image.jpg' );
imagealphablending($image, true);
$transparentcolour = imagecolorallocate($image, 255,255,255);
imagecolortransparent($image, $transparentcolour)
The imagealphablending($image, true);
is important.
Using imagesavealpha($f, true);
as mentioned in a previous answer definitely doesn't work and seems to actually prevent you from making the background transparent...
To output the transparent image with the correct headers.
<?php
header( 'Content-Type: image/png' );
imagepng( $image, null, 1 );
?>