![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
30/10/2007, 02:48
|
| | Fecha de Ingreso: abril-2007
Mensajes: 4
Antigüedad: 17 años, 9 meses Puntos: 0 | |
Re: Pregunta muy concreta sobre subir archivos a la vez que se crea un thumbail Muy buenas!!
Para subir las imagenes yo lo haría por HTML, puedes encontrar formularios para upload de archivos en HTML en cualquier sitio.
Para hacer el thumbnail, yo usaría la función imagecopyresampled de PHP. Aquí te pongo un ejemplo muy sencillo:
<?php
// The file
$filename = 'test.jpg';
$percent = 0.5;
// Content type
header('Content-type: image/jpeg');
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
// Output
imagejpeg($image_p, null, 100);
?>
Espero que te sirva de ayuda!!!
Salu2 |