Programación Web y Scripting > PHP

 Mostrar Imagenes Antes De Subir A La Bd

<< < (3/4) > >>

zaida20:
duda resuelta!!! ;)

De nuevo mil gracias por tu ayuda F_Tanori!!!!

Saludos!!!! :hola:

zaida20:
Hola:
tengo otra duda más, necesito que antes de mostrarme la imagen que voy a subir a la base de datos me valide si está dañada o no, es decir, que se pueda visualizar la imagen sin problemas.
¿Cómo puedo hacerlo?

El código que tengo es éste:


--- Código: Text ---&#60;?phpsession_start();&#036;ruta_imagen=&#036;_GET['ruta'];if(&#036;ruta_imagen!=NULL){if(&#036;_SESSION['foto']==NULL){  &#036;rut=array();  &#036;rutimagen[0]=&#036;ruta_imagen;  &#036;_SESSION['foto']=&#036;rutimagen;  &#036;popo=&#036;_SESSION['foto'];}else{  &#036;foto=&#036;_SESSION['foto'];  &#036;num=count(&#036;foto);  &#036;rutimagen=&#036;_SESSION['foto'];  &#036;rutimagen[&#036;num]=&#036;ruta_imagen;  &#036;_SESSION['foto']=&#036;rutimagen;  &#036;popo=&#036;_SESSION['foto'];}   }?&#62;&#60;html&#62;        &#60;table width=&#34;265&#34; height=&#34;80&#34; border=&#34;0&#34; cellpadding=&#34;0&#34; cellspacing=&#34;0&#34;&#62;          &#60;?php      &#036;i=0;  while(&#036;popo[&#036;i]!=NULL)  {    &#036;size=getimagesize(&#036;popo[&#036;i]);    &#036;ancho[&#036;i]=(int) (&#036;size [0]* 0.5);    &#036;alto[&#036;i] =(int) (&#036;size [1]* 0.5);    ?&#62;          &#60;tr&#62;            &#60;td&#62;&#60;img src=&#34;&#60;?php echo &#036;popo[&#036;i]; ?&#62;&#34; width=&#34;&#60;?php echo &#036;ancho[&#036;i]; ?&#62;&#34;  height=&#34;&#60;?php echo &#036;ancho[&#036;i]; ?&#62;&#34;&#62;&#60;/td&#62;          &#60;/tr&#62;          &#60;tr&#62;            &#60;td height=&#34;1&#34; bgcolor=&#34;#CCCCCC&#34;&#62;&#60;img src=&#34;../img/transparente.gif&#34; width=&#34;50&#34; height=&#34;1&#34;&#62;&#60;/td&#62;          &#60;/tr&#62;      &#60;?php      &#036;i++;      }      ?&#62;        &#60;/table&#62;&#60;/html&#62; 
Muchisimas gracias
Saludos  :hola:

Altareum:
Pues, ya lo estás haciendo-.... La función getimagesize verifica que el archivo no esté corrupto:


--- Citar ---Si no es posible acceder a la imagen nombre_archivo, o si no es una imagen válida, getimagesize() devolverá FALSE y generará un error de nivel E_WARNING.
--- Fin de la cita ---

Por lo que deberías poner:

if( $size=getimagesize($popo[$i]) )

Altareum.

zaida20:
Muchas gracias, lo probaré mañana en el trabajo.

Saludos!!! :hola:

zaida20:
Perfecto Altareum!!! :bravo:

Gracias por tu ayuda!!

Saludos!! :hola:

Navegación

[0] Índice de Mensajes

[#] Página Siguiente

[*] Página Anterior

Ir a la versión completa