Hello,
I use this code to resize images:
<?php
function makeresize($dir,$pic,$n,$t){
@list($width, $height, $type, $attr) = @getimagesize($pic);
$max_w = 700;
$max_h = 500;
$ratio = @min($max_w/$width,$max_h/$height);
if ($ratio < 1){
$w = @floor($ratio*$width);
$h = @floor($ratio*$height);
$thumb = @imagecreatetruecolor($w,$h);
if ($t == 'image/jpeg'){$temp = @imagecreatefromjpeg($pic);}
elseif ($t == 'image/gif'){$temp = @imagecreatefromgif($pic);}
elseif ($t == 'image/png'){$temp = @imagecreatefrompng($pic);}
@imagecopyresampled($thumb,$temp,0,0,0,0,$w,$h,$width,$height);
if ($t == 'image/jpeg'){@imagejpeg($thumb,"$dir/".$n, 100);}
elseif ($t == 'image/gif'){@imagegif($thumb,"$dir/".$n, 100);}
elseif ($t == 'image/png'){@imagepng($thumb,"$dir/".$n, ;}
}
}
?>
the code that calls the function above is:
$tipi_consentiti = array("image/gif","image/jpeg","image/png","image/pjpeg");
// form data
$titolo = @addslashes($_POST['titolo']);
$descrizione = @addslashes($_POST['descrizione']);
$nome = @addslashes($_FILES['imagefile']['name']);
$path = $carfoto_user . stripslashes($nome);
$tipo = @addslashes($_FILES['imagefile']['type']);
............
if ((@in_array($_FILES['imagefile']['type'], $tipi_consentiti))&& ($_FILES["imagefile"]["size"] < 2200000)){
// copio il file nella cartella delle immagini
@copy ($_FILES['imagefile']['tmp_name'], $carfoto_user . $nome);
$nomenew = $t."_".$nome;
@makeresize($carfoto_user,$path,$nomenew,$tipo);
unlink($carfoto_user.$nome);
well.
everything works fine, but now I want to paste the resized image produced
on another image that has a fixed size.
It is necessary for javascript gallery output (if the image is too small).
How can I change the above code to do this.
Can you help me?
Thanks in advance..sorry for my english please :-\