Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal o q ha de errado nesse codigo? :(
<?echo "teste";include ("../config.php");# funções #function type_verify($ftype,$ptypes){ $res = false; for($i = 0; $i < count($ptypes); $i++){ if($ftype == $ptypes[$i]){ $return = true; break; } } return $res;}function alter_img_dimensions($x, $y, $file, $ftype){ list($width_orig, $height_orig, $type) = getimagesize($file); if($width && ($width_orig < $height_orig)){ $width = ($height / $height_orig) * $width_orig; } else{ $height = ($width / $width_orig) * $height_orig; } switch($ftype){ case "image/pjpeg": $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($file); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); imagejpeg($image_p, $file, 80); break; case "image/gif": $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromgif($file); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); imagegif($image_p, $file, 80); break; }}# fim de funções #$res_album = mysql_query("SELECT * FROM `".$pre."albuns`") or die("Erro no SQL: ".mysql_error());if(!(mysql_num_rows($res_album) > 0)){ exit("Voce precisa inserir um album primeiro.");}# cofiguração #$perm_size = 400; // Limite de KBytes$width = 200; //Altura maxima$height = 200; //Largura Maxima$perm_types = array("image/gif","image/pjpeg","image/jpeg","image/x-png");# fim de cinfiguração #if(isset($_POST['insert'])){ $id = $_POST['album_id']; $res_album = mysql_query("SELECT * FROM `".$pre."albuns` WHERE `id`='$id' LIMIT 1") or die("Erro no SQL: ".mysql_error()); $row = mysql_result($res_album) or die("Erro no SQL: ".mysql_error()); $folder = $row['folder']; $full_path = $img_dir.$folder."/"; $file_temp_name = $_FILES['img_file']['tmp_temp']; $file_name = $_FILES['img_file']['name']; $file_type = $_FILES['img_file']['type']; $file_size = $_FILES['img_file']['size']; $img_file = $full_path.$file_name; if($imgt <> "none"){# if(($_FILES['img_file']['type'] <> "image/gif") and ($_FILES['img_file']['type'] <> "image/pjpeg") and ($_FILES['img_file']['type'] <> "image/jpeg") and ($_FILES['img_file']['type'] <> "image/x-png")){ if(type_verify($img_type,$perm_types)){ $error++; $errors .= "Tipo de arquivo não pemitido -> $file_type\.<br>"; } if($size > ($perm_size * 1000)){ $error++; $errors .= "O tamanho do arquivo é maior que $perm_size Kbyte.<br>"; } if(file_exists($dest.$file_name)){ $error++; $errors .= "O arquivo $file_name já existe.<br>"; } } else{ $error++; $errors .= "Não foi informado um arquivo.<br>"; } if($error == 0){ if(is_uploaded_file($file_temp_name)){ $res_album = mysql_query("SELECT * FROM `".$pre."albuns` WHERE `id`='".$_POST['album_id']."' LIMIT 1") or die("Erro no SQL: ".mysql_error()); $row = mysql_fetch_array($res_album) or die("Erro no SQL: ".mysql_error()); if(move_uploaded_file($file_temp_name,$full_path.$file_name)){ mysql_query("INSERT INTO `."$pre".imgs` (`id`,`album_id`,`img`,`title`,`desc`,`date`) VALUES ('','$id','$file_name','".$_POST['title']."','".$_POST['desc']."',CURDATE());") or die("Erro no SQL: ".mysql_error()); alter_img_dimensions($width, $height, $img_file, $file_type); } else{ $errors .= "Não foi possíel fazer o upload do arquivo.<br>"; } } else{ $errors .= "Não foi possíel fazer o upload do arquivo.<br>"; } } else{ echo "Foram encontrados os seguintes erros:<br>$errors"; }}?>???
Não estou conseguindo indentivicar :(
Carregando comentários...