Codice PHP:
<?php
header
('Content-type: image/jpeg');

/* bla bla il resto dello script, basta che non abbia output */

list($width$height) = getimagesize($percorso_small); 
$thumb imagecreatetruecolor(640480); 
$source imagecreatefromjpeg("../public/immagini/small/".$coda."/file.jpg"));
imagecopyresampled($thumb$source0000640480$width$height);

imagejpeg($thumb);
?>
ammesso che i percorsi siano giusti (perche' non usi sempre $percorso_small?)