PHP imagejpeg不起作用

Using this logic to resize and print an image:

$image_path="path/to/image.extension";  
$image_path=imagecreatefromjpeg($image_path);  

$width=imagesx($image_path);  
$height=imagesy($image_path);  
$new_image=imagecreatetruecolor($w, $h);  
imagecopyresampled($new_image,$image_path,0,0,0,0,$w,$h,$width,$height);  
header('Content-Type: image/jpeg');  
imagejpeg($new_image,100);
imagedestroy($new_image);

But I am getting image missing icon as output. What is the mistake I do? I have tried printing the variables $width and $height and it prints the dimension of source image. So the path is correct.

What could be the error?

The mistake was in the line imagejpeg($new_image,100);

It must be imagejpeg($new_image); Quality must not be included in that, if not intended to save.