questo codice scrive in alto a sx la dimensione in byte dell'immagine:
codice:
$immagine="test.jpg";
$fp=fopen($immagine,"r");
$handle=fread($fp,filesize($immagine));
$src_img=imagecreatefromstring ($handle);
$x=400;
$y=300;
$im=Imagecreatetruecolor($x,$y);
imagecopyresampled($im,$src_img, 0, 0, 0, 0, $x, $y, imagesx($src_img), imagesy($src_img));
$textcolor = imagecolorallocate($im, 0, 0, 255);
if (1 == 1){ //CONDIZIONE PER AVERE L'IMMAGINE RIDIMENSIONATA OPPURE ORIGINALE
ob_start();
imagejpeg($im,"",50);
$image_data = ob_get_contents();
ob_end_clean();
$testo=strlen($image_data);
imagestring($im, 5, 0, 0, $testo, $textcolor);
} else {
$testo=strlen($handle);
$im=$src_img;
imagestring($im, 5, 0, 0, $testo, $textcolor);
}
header("content-type: image/jpeg");
imagejpeg($im,"",50);
imagedestroy($im);