Originariamente inviato da willybit
Ciao jeck,
hai del codice da postare? Potrebbe essere un problema di cache
Ciao, quello che vedi è solo la funzione di una classe che esegue diverse operazioni, la funzione ridimensiona l'immagine, inserisce un watermark e invia l'immagine all'esterno.
Codice PHP:
function getImageResized(){
list($larghezza, $altezza, $tipo, $attr)=getimagesize($this->percorsoOld);
$imgDest = ImageCreateTrueColor($this->larghezza,$this->altezza);
if($tipo==2)
$srcImg=ImageCreateFromJpeg($this->percorsoOld);
if($tipo==1)
$srcImg=ImageCreateFromGif($this->percorsoOld);
if($tipo==3)
$srcImg=ImageCreateFromPng($this->percorsoOld);
ImageCopyResampled($imgDest, $srcImg, 0, 0, 0, 0, $this->larghezza,$this->altezza, ImageSX($srcImg),ImageSY($srcImg));
$watermark = imagecreatefromgif('image/watermark.gif');
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);
//ridimensione il watermark
if($this->larghezza>=($watermark_width*2) && $this->water){
// imagecopymerge($imgDest, $watermark, (($this->larghezza/2)-($watermark_width/2)), (($this->altezza/2)-($watermark_height/2)), 0, 0, $watermark_width, $watermark_height, 100);
imagecopymergegray($imgDest, $watermark, (($this->larghezza/2)-($watermark_width/2)), (($this->altezza/2)-($watermark_height/2)), 0, 0, $watermark_width, $watermark_height, 60);
}
header('Content-Type: ' . $tipo[2]);
ImageJpeg($imgDest,'',100);
imagedestroy($imgDest);
imagedestroy($srcImg);
imagedestroy($water1);
clearstatcache();
}
il file che contiene la classe lo richiamo in questo modo la prima volta che deve vedere l'immagine e funziona.
resizeImage.php?file=top_gallery.jpg&tipo=6&type=b irra
la classe esegue prima dei controlli sui dati che gli vengono passati e poi richiama la funzione sopra.
Quando tramite js cambio immagine inserisco all'evento onclick questo codice
codice:
function impFoto(inFoto){
if(document.all)
var g=document.all.contFotoB;
else
var g=document.getElementById("contFotoB");
g.src="resizeImage.php?file="+inFoto+"&type=foto&tipo=5";
return false;
}
contFotoB è l'id associato al tag img
l'immagine mi sparisce dallo schermo, ma non si vede quella nuova