connectToDB(); function connectToDB() { global $link; $link = mysql_connect("62.149.150.93", "Sql255709", "a5a12de0"); if (! $link) die("Impossibile connettersi al server MySQL"); mysql_select_db("Sql255709_1",$link) or die("Impossibile aprire il database falegnameria progi:".mysql_error() ); } function convertfoto($id_foto,$tipo,$nome_foto='foto1_') { $load = $_SERVER['DOCUMENT_ROOT']. "/photo/" . $nome_foto . $id_foto . ".jpg"; $im = imagecreatefromjpeg($load); $x=imagesx($im); $y=imagesy($im); switch ($tipo) { case th1: $save = $_SERVER['DOCUMENT_ROOT'] . "/photo/" . $nome_foto . $id_foto . "th.jpg"; $w=129; $h=94; break; case th2: $save = $_SERVER['DOCUMENT_ROOT'] . "/photo/" . $nome_foto . $id_foto . "th.jpg"; $w=388; $h=276; break; case th3: $save = $_SERVER['DOCUMENT_ROOT'] . "/photo/" . $nome_foto . $id_foto . "th.jpg"; $w=114; $h=56; break; } $hr=($y/$x)*$w; $yr=($hr/2)-($h/2); $resize=imagecreatetruecolor($w,$hr); imagecopyresized($resize, $im, 0, 0, 0, 0, $w, $hr, $x, $y); //taglia la foto dal centro, calcolando la metą dell'altezza $thumbnail=imagecreatetruecolor($w,$h); imagecopyresized($thumbnail, $resize, 0, 0, 0, $yr, $w, $h, $w, $h); imagejpeg($thumbnail,$save,80); chmod("$save", 0777); imagedestroy($im); imagedestroy($thumbnail); imagedestroy($resize); } function checkfoto($id_foto,$nome_foto='foto1_') { $load = $_SERVER['DOCUMENT_ROOT'] . "/photo/" . $nome_foto . $id_foto . ".jpg"; $im = imagecreatefromjpeg($load); $x=imagesx($im); $y=imagesy($im); $w=600; $h=400; if ($x>$w) { $hr=($y/$x)*$w; $resize=imagecreatetruecolor($w,$hr); imagecopyresized($resize, $im, 0, 0, 0, 0, $w, $hr, $x, $y); imagejpeg($resize,$load,80); chmod("$load", 0777); imagedestroy($resize); } elseif ($y>$h) { $wr=($h/$y)*$x; $resize=imagecreatetruecolor($wr,$h); imagecopyresized($resize, $im, 0, 0, 0, 0, $wr, $h, $x, $y); //ridimensiona la foto se pił larga di 1000px e/o pił alta di 600px imagejpeg($resize,$load,80); chmod("$load", 0777); imagedestroy($resize); } imagedestroy($im); } ?>Access denied for user ''@'localhost' (using password: NO)