Funziona...
grazie mille per la dritta
posto il codice PHP
Codice PHP:
if($foto[tmp_name]){
//creazione miniatura
ridimensionaimg($foto["tmp_name"],10,1000, 1000);
$buffer = addslashes(fread(fopen($foto["tmp_name"], "rb"), $foto["size"]));
$sql="insert into foto(foto,nome_immagine) values('$buffer','$nome_immagine')";
mysql_query($sql)or die(mysql_error().$sql);
e...
Codice PHP:
function ridimensionaimg($nomefile,$percent,$maxwidth, $maxheight){
list($width, $height) = getimagesize($nomefile);
if ($percent > 0)
{
$newwidth = $width * $percent/100;
$newheight = $height * $percent/100;
}
else
{
$newwidth = $width;
$newheight = $height;
}
if ($maxwidth > 0 )
{
if ($newwidth > $maxwidth)
{
$newwidth = $maxwidth;
$newheight = ($newwidth * $height) / $width;
}
}
if ($maxheight > 0 )
{
if ($newheight > $maxheight)
{
$newheight = $maxheight;
$newwidth = ($newheight * $width) / $height;
}
}
$source = imagecreatefromjpeg($nomefile);
$buffer = imagecreatetruecolor($newwidth, $newheight);
imagecopyresized($buffer,$source,0,0,0,0,$newwidth,$newheight,$width,$height);
imagejpeg($buffer,$nomefile);
}