Ver Mensaje Individual
  #4 (permalink)  
Antiguo 06/08/2004, 12:01
Avatar de Fher
Fher
 
Fecha de Ingreso: febrero-2003
Ubicación: En algun lugar de cancun
Mensajes: 384
Antigüedad: 22 años
Puntos: 0
mmmm ya me creo el primer error

Hola rookt pues resulta que no me guarda la imagen en mi directorio, tu sabes a que se debe si no marca error de permisos o es que hace falta algo

aqui esta el codigo

<% @Page Language="C#" %>
<% @Import Namespace="System.Drawing" %>
<% @Import Namespace="System.IO" %>
<% @Import Namespace="System.Drawing.Imaging" %>
<% Response.Expires = 0;
Bitmap newBitmap = null;
Graphics g = null ;

string str2Render = "hola"; //Request.QueryString.Get("HitCount");
if (null == str2Render) str2Render = "No especificado";
string strFont = Request.QueryString.Get("HitFontName");
if (null == strFont) strFont = "Lucida Sans Unicode";

int nFontSize = 9;
try
{
nFontSize = Int32.Parse(Request.QueryString.Get("HitFontSize") );
}
catch
{
// do nothing, just ignore
}

string strBackgroundColorname = Request.QueryString.Get("HitBackgroundColor");
Color clrBackground = Color.White;
try
{
// Format in the URL: %23xxXXxx
if (null != strBackgroundColorname)
clrBackground = ColorTranslator.FromHtml(strBackgroundColorname);
}
catch
{
}
string strFontColorName = Request.QueryString.Get("HitFontColor");
Color clrFont = Color.Black;
try
{
// Format in the URL: %23xxXXxx
if (null != strFontColorName)
clrFont = ColorTranslator.FromHtml(strFontColorName);
}
catch
{
}
try
{
Font fontCounter = new Font(strFont, nFontSize);
// calculate size of the string.
newBitmap = new Bitmap(1,1,PixelFormat.Format32bppArgb);
g = Graphics.FromImage(newBitmap);
SizeF stringSize = g.MeasureString(str2Render, fontCounter);
int nWidth = (int)stringSize.Width;
int nHeight = (int)stringSize.Height;
g.Dispose();
newBitmap.Dispose();
newBitmap = new Bitmap(nWidth,nHeight,PixelFormat.Format32bppArgb) ;
g = Graphics.FromImage(newBitmap);
g.FillRectangle(new SolidBrush(clrBackground), new Rectangle(0,0,nWidth,nHeight));
g.DrawString(str2Render, fontCounter, new SolidBrush(clrFont), 0, 0);

MemoryStream tempStream = new MemoryStream();
newBitmap.Save(tempStream,ImageFormat.Png);
Response.ClearContent();
Response.ContentType = "image/png";
Response.BinaryWrite(tempStream.ToArray());
Response.End();

**** Aqui es el problema **

// aqui es donde se salva....
newBitmap.Save(Response.OutputStream, ImageFormat.Png);
newBitmap.Save("c:\\Inetpub\\wwwroot\\nuke\\ver.pn g", ImageFormat.Png) ;

****************
}
catch (Exception e)
{
Response.Write(e.ToString());
}
finally
{
if (null != g) g.Dispose();
if (null != newBitmap) newBitmap.Dispose();
}
%>

sera cosa de las diagonales
__________________
solo firma