Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/05/2010, 19:17
Dr_Chichi
 
Fecha de Ingreso: septiembre-2006
Mensajes: 330
Antigüedad: 17 años, 7 meses
Puntos: 2
imagenes aleatorias

hola ocnsegui este codigo el problema es que las fotos salen de su tamano original como pongo que me salgan siempre del mismo tamaño es decir ponerle width="210" height="210" alguien puede ayudarme por favor

Código:
<?php
//Configurar carpeta
$folder = '/aqui/ladireccion/www'; // esta linea se editará cuando pongas tu direccion que viene siendo lo de verde.
//MIME TYPES
$extList = array();
$extList['gif'] = 'image/gif';
$extList['jpg'] = 'image/jpg';
$extList['jpeg'] = 'image/jpeg';
$extList['png'] = 'image/png';
$img = null;
if (substr($folder,-1) != '/') {
$folder = $folder.'/';
}
if (isset($_GET['img'])) {
$imageInfo = pathinfo($_GET['img']);
if (
isset ( $extList[ strtolower( $imageInfo['extension'] ) ] ) &&
file_exists($folder.$imageInfo['basename'] )
) {
$img = $folder.$imageInfo['basename'];
}
} else {
$fileList = array();
$handle = opendir($folder);
while ( false !== ( $file = readdir($handle) ) ) {
$file_info = pathinfo($file);
if (
isset( $extList[ strtolower( $file_info['extension'] ) ] )
) {
$fileList[] = $file;
}
}
closedir($handle);
if (count($fileList) > 0) {
$imageNumber = time() % count($fileList);
$img = $folder.$fileList[$imageNumber];
}
}
if ($img!=null) {
$imageInfo = pathinfo($img);
$contentType = 'Content-type: '.$extList[ $imageInfo['extension'] ];
header ($ContentType);
readfile($img);
} else {
if ( function_exists('imagecreate') ) {
header ("Content-type: img/png");
$im =@imagecreate (100,100)
or die ("Cannot initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$tex_color = imagecolorallocate ($im, 0,0,0);
imagestring ($im, 2, 5, 5, "IMAGE ERROR", $text_color);
imagepng($im);
imagedestroy($im);
}
}
?>