codice:
imagejpeg($im,'immagine',70); 
.
.
.
$data = addslashes(fread(fopen('immagine.temp', 'rb'), filesize('immagine')));