= $p_final) { $nova_largura = ($d[0]-(($largura*$d[1])/$altura))/2; $x_i = $nova_largura; $x_f = $d[0]-$nova_largura*2; $y_i = 0; $y_f = $d[1]; } else { $x_i = 0; $x_f = $d[0]; $nova_altura = ($d[1]-(($altura*$d[0])/$largura))/2; $y_i = $nova_altura; $y_f = $d[1]-$nova_altura*2; } $foto_mime = $d['mime']; if ($foto_mime == "image/jpeg"){ header("Content-type: image/jpeg"); $src = imagecreatefromjpeg($foto); } else if ($foto_mime == "image/gif") { header("Content-type: image/gif"); $src = imagecreatefromgif($foto); } else if ($foto_mime == "image/bmp") { header("Content-type: image/bmp"); $src = imagecreatefromwbmp($foto); } else if ($foto_mime == "image/png") { header("Content-type: image/png"); $src = imagecreatefrompng($foto); } $dst = ImageCreateTrueColor($largura, $altura); $white = imagecolorallocate($dst,255,255,255); imagefill($dst,0,0,$white); imagecopyresampled($dst,$src,0,0,$x_i,$y_i,$largura,$altura,$x_f,$y_f); if ($foto_mime == "image/jpeg"){ imagejpeg($dst, null, 98); } else if ($foto_mime == "image/gif") { imagegif($dst, null, 98); } else if ($foto_mime == "image/bmp") { imagewbmp($dst, null, 98); } else if ($foto_mime == "image/png") { imagepng($dst, null, 98); } imagedestroy($dst); imagedestroy($src); } } else if(strpos($_SERVER['REQUEST_URI'], '%3Fend') > 0){ $url_destino = "http://www.vendasnaweb.net".urldecode($_SERVER['REQUEST_URI']); header( "HTTP/1.1 301 Moved Permanently" ); header( "Location: ".$url_destino ); exit; //Oportunidade de melhoria: implementar direcionamento para URL amigavel } else { //Acesso nao reconhecido ao arquivo! } ?>