Puoi provare a commentare la riga
Codice PHP:
header("Content-Type: image/jpeg"true); 
e vedere se spunta qualche errore.