Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Carcleo

Fuções asp

Recommended Posts

Ola pessoal!O php tem as seguintes funções:1 - Verifica se o mime-type do arquivo é de imagem if(!eregi("^image\/(pjpeg|jpeg|png|gif|bmp)$", $arquivo["type"])) { $erro[] = "Arquivo em formato inválido! A imagem deve ser jpg, jpeg, bmp, gif ou png. Envie outro arquivo"; }2 - // Faz o upload da imagemmove_uploaded_file($arquivo, $diretorio)e no asp, como seria?

Compartilhar este post


Link para o post
Compartilhar em outros sites

Vê se esse script ai te ajuda !!!

 

<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %><script language="C#" runat="server">void Page_Load(Object sender, EventArgs e){	try{  Response.Cache.VaryByParams["Image;Width;Height;ForceAspect"] = true;  Response.ContentType = "../images/";  System.Collections.Hashtable imageOutputFormatsTable = new System.Collections.Hashtable();  imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Gif.Guid, System.Drawing.Imaging.ImageFormat.Gif);  imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Jpeg.Guid, System.Drawing.Imaging.ImageFormat.Jpeg);  imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Bmp.Guid, System.Drawing.Imaging.ImageFormat.Gif);  imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Tiff.Guid, System.Drawing.Imaging.ImageFormat.Jpeg);  imageOutputFormatsTable.Add(System.Drawing.Imaging.ImageFormat.Png.Guid, System.Drawing.Imaging.ImageFormat.Jpeg);	  string imageLocation;  bool forceaspect = true;  int newHeight;  int newWidth;  int reqHeight = 100;  int reqWidth = 100;  int origHeight;  int origWidth;    imageLocation = Server.MapPath(Request.QueryString["Image"]);  if (Request.QueryString["Height"] != null){ 	 reqHeight = Convert.ToInt32(Request.QueryString["Height"]);  }  if (Request.QueryString["ForceAspect"] != null){ 	 forceaspect = Convert.ToBoolean(Request.QueryString["ForceAspect"]);  }  if(Request.QueryString["Width"] != null){ 	 reqWidth = Convert.ToInt32(Request.QueryString["Width"]);  }  if (Request.QueryString["ForceAspect"] == "true"){ 	 forceaspect = true;  }    System.Drawing.Bitmap origBitmap = new System.Drawing.Bitmap(imageLocation);  origHeight = origBitmap.Height;  origWidth = origBitmap.Width;    if (forceaspect){ 	 //Force Aspect Change 	 newHeight = reqHeight; 	 newWidth = reqWidth;  }    else if (origBitmap.Height >= origBitmap.Width){ 	 //Portrait 	 newHeight = reqHeight; 	 newWidth = (int)(((double)origBitmap.Width / (double)origBitmap.Height) * reqHeight);  }  else{  	 //Landscape 	 newWidth = reqWidth; 	 newHeight = (int)(((double)origBitmap.Height / (double)origBitmap.Width) * reqWidth);  }      System.Drawing.Bitmap outputImage = new System.Drawing.Bitmap(origBitmap, newWidth, newHeight);  outputImage.SetResolution(24, 24);  	  //outputImage.InterpolationMode = InterpolationMode.HighQualityBicubic;  System.Drawing.Imaging.ImageFormat outputFormat = (System.Drawing.Imaging.ImageFormat)imageOutputFormatsTable[origBitmap.RawFormat.Guid];    outputImage.Save(Response.OutputStream, outputFormat);  outputImage.Dispose();  origBitmap.Dispose();	}	catch{  Response.Redirect("thumberror.gif");	}}</script>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Colega, eu to saindo do php, vindo pro asp.Teria como, se num for pedir muito, explicar o código melhor?Muito obrigado.Carlos

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.