Foros del Web » Programando para Internet » PHP »

ayuda con codigo?? para hacer thumbnails

Estas en el tema de ayuda con codigo?? para hacer thumbnails en el foro de PHP en Foros del Web. bueno este es el codigo que tengo para hacer thumbnails, y si sirve y todo, osea si me los hace resize y todo, el uniko ...
  #1 (permalink)  
Antiguo 01/10/2008, 23:07
 
Fecha de Ingreso: enero-2008
Mensajes: 214
Antigüedad: 16 años, 2 meses
Puntos: 3
ayuda con codigo?? para hacer thumbnails

bueno este es el codigo que tengo para hacer thumbnails, y si sirve y todo, osea si me los hace resize y todo, el uniko inconveniente es que cuando kiero abrir una imagen si la habre pero ya en otra pagina, y pos kiero que me habra la imagen en la misma asi como en hi5 que tiene sus imagenes y que si le das click en una te la habre pero en la misma pagina. alguien sabe como hacerlo?? desde ya gracias


Código PHP:
<?php
function createThumbs$pathToImages$pathToThumbs$thumbWidth 
{
  
$pathToImages "img/";
  
$dir opendir$pathToImages );

  while (
false !== ($fname readdir$dir ))) {
    
$info pathinfo($pathToImages $fname);
    if ( 
strtolower($info['extension']) == 'jpg' 
    {
      echo 
"Creating thumbnail for {$fname} <br />";

      
$img imagecreatefromjpeg"{$pathToImages}{$fname}" );
      
$width imagesx$img );
      
$height imagesy$img );

      
$new_width $thumbWidth;
      
$new_height floor$height * ( $thumbWidth $width ) );

      
$tmp_img imagecreatetruecolor$new_width$new_height );

      
imagecopyresized$tmp_img$img0000$new_width$new_height$width$height );

      
imagejpeg$tmp_img"{$pathToThumbs}{$fname}" );
    }
  }
  
closedir$dir );
}

function 
createGallery$pathToImages$pathToThumbs 
{
  echo 
"Creating gallery.html <br />";

  echo  
"<html>";
  echo  
"<head><title>Thumbnails</title></head>";
  echo  
"<body>";
  echo  
"<table cellspacing=\"0\" cellpadding=\"2\" width=\"500\">";
  echo  
"<tr>";

  
$dir opendir$pathToThumbs );

  
$counter 0;
  while (
false !== ($fname readdir($dir)))
  {
    if (
$fname != '.' && $fname != '..'
    {
      echo  
"<td valign=\"middle\" align=\"center\"><a href=\"{$pathToImages}{$fname}\">";
      echo  
"<img src=\"{$pathToThumbs}{$fname}\" border=\"0\" />";
      echo  
"</a></td>";

      
$counter += 1;
      if ( 
$counter == ) { $output .= "</tr><tr>"; }
    }
  }
  
closedir$dir );

  echo  
"</tr>";
  echo  
"</table>";
  echo  
"</body>";
  echo  
"</html>";

}

createThumbs("img/","thumbs/",100);
createGallery("img/","thumbs/");
?>
  #2 (permalink)  
Antiguo 02/10/2008, 09:31
Avatar de David
Moderador
 
Fecha de Ingreso: abril-2005
Ubicación: In this planet
Mensajes: 15.720
Antigüedad: 19 años
Puntos: 839
Respuesta: ayuda con codigo?? para hacer thumbnails

Se podría hacer con Javascript, dependiendo de cómo exactamente quieres que se vea, cambiando el src de un tag <img> donde quieres que se vea la imagen por la imagen grande.
__________________
Por favor, antes de preguntar, revisa la Guía para realizar preguntas.
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 06:59.