Foros del Web » Programando para Internet » ASPX (.net) »

Problemas al mostrar imagen

Estas en el tema de Problemas al mostrar imagen en el foro de ASPX (.net) en Foros del Web. Saludos seniores/as, Les presento el problema, tengo una galeria de imagenes en asp, todo muy bien en ie, pero en firefox y en safari hay ...
  #1 (permalink)  
Antiguo 10/07/2008, 20:14
 
Fecha de Ingreso: junio-2005
Mensajes: 146
Antigüedad: 18 años, 10 meses
Puntos: 0
Problemas al mostrar imagen

Saludos seniores/as,

Les presento el problema, tengo una galeria de imagenes en asp, todo muy bien en ie, pero en firefox y en safari hay problema, les explico,

si entras a http://soccerliverd.com/sl/galeria.aspx?a=110&z=0 veras una galeria de imagenes, pero si clickeas en una de las fotos por ejemplo http://soccerliverd.com/xcms/verImagen.aspx?a=484, en ie sale muy bine la imagen pero en firefox y safari no, acountinuacion el codigo de verImagen.aspx

Código:
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
    
    string ConnectionString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"];

	protected void Page_Load(object sender, EventArgs e)
	{
        string Imagen = "imagenes/none.gif";
        
        if (Request.QueryString["a"] != null)
        {            
            foreach (DataRow row in Data("SELECT ImagenID, Nombre, Ruta FROM vw_Imagenes WHERE ImagenID = " + Request.QueryString["a"].ToString(), "").Rows)
            {
                Imagen = row["Ruta"].ToString() + "/" + row["Nombre"].ToString();
            }
        }

        Bitmap foto = new Bitmap(Server.MapPath(Imagen));
        Bitmap img = null;
        if (Request.QueryString["w"] != null)
        {
            int w = int.Parse(Request.QueryString["w"]);
            if (w != 0)
            {
                img = new Bitmap(foto, w, w);
            }
            else
            {
                img = foto;
            }
        }
        else
        {
            img = foto;
        }
        
        Response.Clear();
        img.Save(Response.OutputStream, ImageFormat.Jpeg);
        Response.End();    
	}

    private DataTable Data(string storeProcedure, string parameters)
    {
        DataTable Table = new DataTable();
        SqlConnection conn = new SqlConnection(ConnectionString);
        SqlCommand comm = new SqlCommand(storeProcedure + " " + parameters, conn);
        SqlDataAdapter da = new SqlDataAdapter(comm);

        try
        {
            conn.Open();
            da.Fill(Table);
            comm.Dispose();
            conn.Close();
            conn.Dispose();

        }
        catch (SqlException e)
        {
            throw new System.Exception(e.Message);
        }

        return Table;
    }
	
</script>
por favor daria la vida por que alguien me ayude, gracias de ante mano!

Edgar Nadal
(firma removida...)
__________________
Edgar Nadal

Última edición por AlZuwaga; 10/07/2008 a las 22:54
  #2 (permalink)  
Antiguo 14/07/2008, 08:46
 
Fecha de Ingreso: septiembre-2007
Mensajes: 58
Antigüedad: 16 años, 7 meses
Puntos: 0
Respuesta: Problemas al mostrar imagen

Intenta poniendo esto:

Response.Clear();
Response.ContentType = "image/pjpeg"
'img.Save(Response.OutputStream, ImageFormat.Jpeg);

Response.End();
  #3 (permalink)  
Antiguo 14/07/2008, 10:34
Avatar de RootK
Moderador
 
Fecha de Ingreso: febrero-2002
Ubicación: México D.F
Mensajes: 8.004
Antigüedad: 22 años, 2 meses
Puntos: 50
Respuesta: Problemas al mostrar imagen

así es, te falta indicar el contenttyp

Cita:
Response.Clear();
Response.ContentType = "image/jpeg"
img.Save(Response.OutputStream, ImageFormat.Jpeg);
Response.End();
Salu2
__________________
Nadie roba nada ya que en la vida todo se paga . . .

Exentrit - Soluciones SharePoint & Net
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:28.