Foros del Web » Programando para Internet » PHP »

Funcion de thumbnail a temporal

Estas en el tema de Funcion de thumbnail a temporal en el foro de PHP en Foros del Web. Quisiera hacer un thumbnail de las imagenes pero TEMPORALMENTE, no crearlas como esta en esta función, no se me ocurre como, ayuda? Código PHP: function  ...
  #1 (permalink)  
Antiguo 15/02/2011, 13:39
 
Fecha de Ingreso: septiembre-2009
Mensajes: 230
Antigüedad: 14 años, 7 meses
Puntos: 2
Funcion de thumbnail a temporal

Quisiera hacer un thumbnail de las imagenes pero TEMPORALMENTE, no crearlas como esta en esta función, no se me ocurre como, ayuda?

Código PHP:
function createthumb($name,$file,$maxsize)
{
  
$maxsize += 8;
  list(
$width$height) = getimagesize("$name/$file");
  
$width min($width$height);
  
$tn imagecreatetruecolor($maxsize$maxsize);
  
$image imagecreatefromjpeg("$name/$file");
  
imagecopyresampled($tn$image0000$maxsize$maxsize$width$width);
  if(!
is_dir("$name/thumbnails"))
  {
    
mkdir ("$name/thumbnails"0777);
  }
  
imagejpeg($tn"$name/thumbnails/tn_$file"90);
  return 
true;

  #2 (permalink)  
Antiguo 15/02/2011, 13:43
Avatar de gusma62  
Fecha de Ingreso: julio-2008
Ubicación: Tepatitlán, Jalisco, Mexico
Mensajes: 167
Antigüedad: 15 años, 9 meses
Puntos: 6
Respuesta: Funcion de thumbnail a temporal

http://www.maestrosdelweb.com/editorial/thumbphp/

Checa esto, es sencillo y funciona
  #3 (permalink)  
Antiguo 15/02/2011, 14:15
 
Fecha de Ingreso: septiembre-2009
Mensajes: 230
Antigüedad: 14 años, 7 meses
Puntos: 2
Respuesta: Funcion de thumbnail a temporal

No funciona ese code, por lo menos no para mi:

Cita:

Warning: imagesx(): supplied argument is not a valid Image resource in C:\AppServ\www\CulturaBahiense\img\th\thumb.php on line 6

Warning: imagesy(): supplied argument is not a valid Image resource in C:\AppServ\www\CulturaBahiense\img\th\thumb.php on line 7

Warning: imagecopyresized(): supplied argument is not a valid Image resource in C:\AppServ\www\CulturaBahiense\img\th\thumb.php on line 10

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\CulturaBahiense\img\th\thumb.php:6) in C:\AppServ\www\CulturaBahiense\img\th\thumb.php on line 12
Código PHP:
<?php 

/*Este Archivo Recibe Los Parametros $ruta, Que Es La Ruta Interna De La Imagen En El Servidor, Y Los Parametros $ancho y $alto Que Se Refiere Al Alto Y Ancho De La Previsualizacion.*/

$fuente = @imagecreatefromgif($ruta);
$imgAncho imagesx($fuente);
$imgAlto imagesy($fuente);
$imagen imagecreate($ancho,$alto);

imagecopyresized($imagen,$fuente,0,0,0,0,$ancho,$alto,$imgAncho,$imgAlto);

header("Content-type: image/jpeg");
imagejpeg($imagen);

?>
Es una imagen JPG 21kbs 415x585. Lista los errores de arriba.
  #4 (permalink)  
Antiguo 15/02/2011, 14:22
 
Fecha de Ingreso: septiembre-2009
Mensajes: 230
Antigüedad: 14 años, 7 meses
Puntos: 2
Respuesta: Funcion de thumbnail a temporal

listo, no era nada.

Etiquetas: funcion, temporal, thumbnails
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 04:41.