Foros del Web » Programando para Internet » PHP »

regalito sencillo pero util | galeria imagenes

Estas en el tema de regalito sencillo pero util | galeria imagenes en el foro de PHP en Foros del Web. ok, estaba sin nada q hacer y dije, bueh voy a devolverle algo a esta comunidad q tanto me ha dado, auqnue no es nada ...
  #1 (permalink)  
Antiguo 12/02/2002, 14:56
 
Fecha de Ingreso: enero-2002
Ubicación: Buenos Aires, Argentina
Mensajes: 193
Antigüedad: 22 años, 3 meses
Puntos: 0
regalito sencillo pero util | galeria imagenes

ok, estaba sin nada q hacer y dije, bueh voy a devolverle algo a esta comunidad q tanto me ha dado, auqnue no es nada de otro mundo es un sencillo script q toma imagenes gif o jpg d eun directorio y hace una galeria, con nombre, fecha y tamaño, espero a alguien le sirva...

nota: las imagenes deben estar en un directorio llamado "img" y el directorio se debe encontrar junto al al fichero donde pegues este código, ojo, no el fichero junto con la imagenes.

galeria.php
----------------------------
<table border=1 bordercolor=black cellpadding=4 cellspacing=2><tr><?
$max = "3"; // máximo de fotos por fila
$num = 0;
$abrir=opendir("img/");
while ($img=readdir($abrir)){
$x1 = explode(".", "$img");
$x2 = count($x1);
if(($x1[$x2-1] == jpg) || ($x1[$x2-1] == JPG) || ($x1[$x2-1] == gif) || ($x1[$x2-1] == GIF)){
$num++;
if($num > $max){
echo"<tr>";
}
$fecha = filectime("img/$img");
$fecha = date("d/m/Y", $fecha);
$tamano = filesize("img/$img");
echo"<td><center><a href='img/$img'><img scr='img/$img' border=0 width=100 height=100></a></center><br><font size=1 face=verdana><b>Nombre</b> : $img<br><b>Fecha</b> : $fecha<br><b>Tamaño</b> : $tamano bytes</font></td>";
if($num == $max){
echo"</tr>";
$num=0;
}
$fecha = "";
$tamano = "";
}
}
?>
</tr>
</table>
-----------------------

a todo a que q le quiciese agregar o cambiar algo, sientace libre de hacerlo y publicarlo obviamente je...

saludos...

<iframe target="_top" src="http://genteloca.com/firma.htm" width="100%" height="70" border="0" framespacing="0" border="0" frameborder="0"> </iframe>
  #2 (permalink)  
Antiguo 12/02/2002, 15:23
 
Fecha de Ingreso: enero-2002
Ubicación: Buenos Aires, Argentina
Mensajes: 193
Antigüedad: 22 años, 3 meses
Puntos: 0
Re: regalito sencillo pero util | galeria imagenes

hey!
hay un pequeño error, me confundi al escribir y en ves de dodne dice:
&lt;img scr=img/$img border=0 width=100 height=100&gt;
cambien:
scr por src, una idiotes, sorry, bye!

<iframe target="_top" src="http://genteloca.com/firma.htm" width="100%" height="70" border="0" framespacing="0" border="0" frameborder="0"> </iframe>
  #3 (permalink)  
Antiguo 12/02/2002, 15:45
Avatar de lado2mx
Colaborador
 
Fecha de Ingreso: agosto-2001
Ubicación: Veracruz
Mensajes: 3.720
Antigüedad: 22 años, 8 meses
Puntos: 9
Re: regalito sencillo pero util | galeria imagenes

ahhh que chido esta
buena esa

<html><center><embed src="http://www.ladodos.com/imagenes/ld.swf" height=40 width=450>
</embed></center></html>
  #4 (permalink)  
Antiguo 12/02/2002, 15:46
Avatar de oSo
oSo
 
Fecha de Ingreso: julio-2001
Mensajes: 468
Antigüedad: 22 años, 9 meses
Puntos: 1
Re: regalito sencillo pero util | galeria imagenes

Excelente! gracias... voy a probarlo y te cuento...

<div align="center"><img src="http://www.negociosenguatemala.com/biz/z/jd/fdwsign.jpg" alt="oSo" border="0"></div>
  #5 (permalink)  
Antiguo 12/02/2002, 16:11
 
Fecha de Ingreso: enero-2002
Ubicación: Buenos Aires, Argentina
Mensajes: 193
Antigüedad: 22 años, 3 meses
Puntos: 0
Re: regalito sencillo pero util | galeria imagenes

ok, de nadas, no duden en aportar lo q quieran...

<iframe target="_top" src="http://genteloca.com/firma.htm" width="100%" height="70" border="0" framespacing="0" border="0" frameborder="0"> </iframe>
  #6 (permalink)  
Antiguo 12/02/2002, 17:44
 
Fecha de Ingreso: enero-2002
Ubicación: Buenos Aires, Argentina
Mensajes: 193
Antigüedad: 22 años, 3 meses
Puntos: 0
Re: regalito sencillo pero util | galeria imagenes

hey, un cambio para hacer la galerie un poco mas util, en este caso si la imagen es .jpg se realiza una imagen a escala dinamica y se muestra, en caso de ser .gif se utilizan los tags width y height para mostrar la imágen a esacala:
consta de dos archivos:

escala.php
---------------------
&lt;?
$sz = 200;
$im = imagecreatefromJpeg(&quot;img/$id&quot;);

$im_width=imageSX($im);
$im_height=imageSY($im);

if($im_width &gt;= $im_height)
{
$factor = $sz/$im_width;
$new_width = $sz;
$new_height = $im_height * $factor;
}
else
{
$factor = $sz/$im_height;
$nuevo_height = $sz;
$nuevo_width = $im_width * $factor;
}

$new_im=ImageCreate($nuevo_width,$nuevo_height);
ImageCopyResized($new_im,$im,0,0,0,0,$nuevo_width, $nuevo_height,$im_width,$im_height);

header(&quot;Content-type: image/jpeg&quot;);
Imagejpeg($new_im,'',75);

ImageDestroy($im);
ImageDestroy($new_im);
?&gt;

----------------------------------
galeria.php
--------------------------------
&lt;table border=1 bordercolor=black cellpadding=4 cellspacing=2&gt;&lt;tr&gt;&lt;?
$max = &quot;3&quot;; // máximo de fotos por fila
$num = 0;
$abrir=opendir(&quot;img/&quot;);
while ($img=readdir($abrir)){
$x1 = explode(&quot;.&quot;, &quot;$img&quot;);
$x2 = count($x1);
if(($x1[$x2-1] == jpg) || ($x1[$x2-1] == JPG) || ($x1[$x2-1] == gif) || ($x1[$x2-1] == GIF)){
$num++;
if($num &gt; $max){
echo&quot;&lt;tr&gt;&quot;;
}
if(($x1[$x2-1] == jpg) || ($x1[$x2-1] == JPG)){
$src= &quot;escala.php?id=$img&quot;;
}else{
$src= &quot;img/$img&quot;;
}
$fecha = filectime(&quot;img/$img&quot;);
$fecha = date(&quot;d/m/Y&quot;, $fecha);
$tamano = filesize(&quot;img/$img&quot;);
echo&quot;&lt;td&gt;&lt;center&gt;&lt;a href='img/$img'&gt;&lt;img src=\&quot;$src\&quot; border=0 width=100 height=100&gt;&lt;/a&gt;&lt;/center&gt;&lt;br&gt;&lt;font size=1 face=verdana&gt;&lt;b&gt;Nombre&lt;/b&gt; : $img&lt;br&gt;&lt;b&gt;Fecha&lt;/b&gt; : $fecha&lt;br&gt;&lt;b&gt;Tamaño&lt;/b&gt; : $tamano bytes&lt;/font&gt;&lt;/td&gt;&quot;;
if($num == $max){
echo&quot;&lt;/tr&gt;&quot;;
$num=0;
}
$fecha = &quot;&quot;;
$tamano = &quot;&quot;;
}
}
?&gt;
&lt;/tr&gt;
&lt;/table&gt;

espero les sirva de algooo



<iframe target="_top" src="http://genteloca.com/firma.htm" width="100%" height="70" border="0" framespacing="0" border="0" frameborder="0"> </iframe>
  #7 (permalink)  
Antiguo 27/04/2004, 12:18
 
Fecha de Ingreso: marzo-2004
Mensajes: 53
Antigüedad: 20 años, 1 mes
Puntos: 0
ayuda please

Hola!

He ejecutado este maravilloso código pero cuando añado el escala.php los thumbanails no los muestra.


Alguien puede darle un repaso?


Gracias.
  #8 (permalink)  
Antiguo 27/04/2004, 13:00
Ex Colaborador
 
Fecha de Ingreso: junio-2002
Mensajes: 9.091
Antigüedad: 21 años, 10 meses
Puntos: 16
Hola,

luque_finde, el codigo es de febrero del 2002. Ha llovido bastante desde entonces. Supongo que ese codigo solo funcionara con versiones y configuraciones antiguas.

Ademas, lo que se lee en el mensaje esta mal formateado. Esos &lt; son realmente <.

Revisa el mensaje de las FAQs (http://www.forosdelweb.com/s/msg108208.html), hay codigo semejante mas moderno.

Saludos.
__________________
Josemi

Aprendiz de mucho, maestro de poco.
  #9 (permalink)  
Antiguo 27/04/2004, 13:42
 
Fecha de Ingreso: marzo-2004
Mensajes: 53
Antigüedad: 20 años, 1 mes
Puntos: 0
ayuda please.

Hola de new!!


Ahora creo que es problema del servidor pq mirar lo q me aparece cuando lo ejecuto:


bash-2.05a$ php escala.php?id=imagen1.jpg
Zend Optimizer requires Zend Engine API version 20020429.
The Zend Engine API version 20010710 which is installed, is outdated.



Un saludo.
  #10 (permalink)  
Antiguo 27/04/2004, 14:04
O_O
 
Fecha de Ingreso: enero-2002
Ubicación: Santiago - Chile
Mensajes: 34.417
Antigüedad: 22 años, 3 meses
Puntos: 129
Bueno .. eso ya son problemas del software que usa ese servidor .. Te dice que te expiró la versión del Zend Optimizer que tiene instalado...

Si tu eres el administrador de ese servidor .. paga la licencia del Zend Optimizer o lo desinstalas (por qué te expiró) .. y si usas un servicio de hosting .. reclama a ellos.

Un saludo,
__________________
Por motivos personales ya no puedo estar con Uds. Fue grato haber compartido todos estos años. Igualmente los seguiré leyendo.
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 11:05.