I have a PHP site that generates images. Doesn't matter if I use GD or Imagick
header('Content-Type: image/jpeg');
imagejpeg($source);
$img = new Imagick($source);
$img->setImageFormat("jpeg");
header('Content-Type: image/'.$img->getImageFormat());
echo $img->getImageBlob();
The image gets correctly served in the browser. But when I try to right-click and download it, Chrome wants to save it as "jfif" file. I understand that jfif is the file format, but I would like Chrome to default save it as "jpg" file. How can I change my PHP code so that Chrome does that?
Note 1: Chrome does allow to default save the file as "jpg" file when it is served directly as jpg-file from my web space.
Note 2: Firefox by default allows to save all my images from the website as "jpg". This is the behaviour I like to have.