You have to choose between the two – either show the image or save it to directory. You cant do both.
imagejpeg($gd_object); //shows the image, requires content-type to be image/jpeg
imagejpeg($gd_object, $filepath); //saves the image, to $filepath
You can try to save the image and then redirect the use to the image if you want to show it.
imagejpeg($gd_object, $filepath);
header("Location: $filepath");
0
solved How to put Image into directory imagejpeg()? [closed]