Premetto che mi sono appena messo a smanettare con le librerie GD per cui devo entrare ancora nella "logica" adatta.
Come da manuale la funzione
imagecreatefromjpeg() returns an image identifier representing the image obtained from the given filename
chiedo a voi un chiarimento (per tutti i dubbi, spero). che cosa significa? o meglio cos'è questo image identifier?
infatti se stampo il risultato della funzione sottostante con
echo $MyImg;
mi stampa:
Resource id #1
GRAZIE!
Codice PHP:
<?
function LoadJpeg ($imgname) {
$im = imagecreatefromjpeg ($imgname); // Attempt to open
if (!$im) { // See if it failed
$im = imagecreate (150, 30); // Create a blank image
$bgc = imagecolorallocate ($im, 255, 255, 255);
$tc = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
// Output an errmsg
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
//header ("Content-type: image/pjpeg");
$sImgPath = 'img/sf_intestazione.jpg';
// $fp = fopen ('http://localhost:81/imm/utils/showimage.php?action=show&id=1&tbl=foto_immobili', "w");
$MyImg = LoadJpeg($sImgPath);
echo $MyImg;
?>