que 400 // if($foto_l > $largura_t) { $d = $foto_l / 440; $final_x = round($foto_l / $d); $final_y = round($foto_a / $d); $criar = ImageCreateTrueColor($final_x, $final_y); ImageCopyResampled($criar, $ims, 0, 0, 0, 0, $final_x, $final_y, $foto_l, $foto_a); ImageJPEG($criar, $IO); } else { // se não, ele copia a imagem do jeito que está // if($_FILES['foto']['tmp_name']) { move_uploaded_file($_FILES['foto']['tmp_name'], $IO); } } } // se a extensao do arquivo for diferente de JPG aparece a msg // if($nome[1]!="jpg") { echo ""; } else { // função para criar a miniatura // function criar_thumbnail($origem, $destino, $largura, $qualidade){ $im = imagecreatefromjpeg($origem); $w = imagesx($im); $h = imagesy($im); if($w > $h){ $nw = $largura; $nh = ($h * $largura)/$w; } else{ $nh = $largura; $nw = ($w * $largura)/$h; } //$ni = imagecreate($nw,$nh); $ni = imageCreateTrueColor($nw,$nh); imagecopyresized($ni,$im,0,0,0,0,$nw,$nh,$w,$h); //imagecopyresampled($ni,$im,0,0,0,0,$nw,$nh,$w,$h); imagejpeg($ni,$destino,$qualidade); } if($_FILES['foto']['tmp_name']){ criar_thumbnail($IO, $ID, 120, 80); } // se o botao SUBMIT for acionado insere dados no db // $dir_gx = str_replace($dir_g, "",$IO); $host = "localhost"; $login = "olsenbr"; $senha = "2005thelorde2"; $db = "olsenbr_olsen"; $con = mysql_connect($host, $login, $senha); mysql_select_db($db, $con); $cadastrar = "INSERT INTO flog_stansyfotos (titulo, com, foto) VALUES ('$titulo','$com' ,'$dir_gx')"; $exe = mysql_db_query("olsenbr_olsen", $cadastrar) or print mysql_error(); } ?>