Foros del Web » Programando para Internet » PHP »

galeria en web dinamica

Estas en el tema de galeria en web dinamica en el foro de PHP en Foros del Web. Hola. Estoy intentando introducir una galeria de imagenes en php en mi web modular. Estar está bien hecha porque si la visualizo sola se ve ...
  #1 (permalink)  
Antiguo 03/03/2005, 09:52
 
Fecha de Ingreso: marzo-2005
Mensajes: 3
Antigüedad: 19 años, 1 mes
Puntos: 0
galeria en web dinamica

Hola.
Estoy intentando introducir una galeria de imagenes en php en mi web modular. Estar está bien hecha porque si la visualizo sola se ve perfectamente, pero si la incluyo como modulo de mi web dinamica no se ve nada, y me da errores del tipo:

Notice: Undefined index: _a in /data/members/free/tripod/es/t/a/r/miweb/htdocs/modulares/modulos/gal/index.php on line 7

Levo dandole vueltas dos semanas y no hay forma de encontrar solucion. Seguro q es una bobada, pero.... Les pongo el codigo por si les sirve. Gracias por su ayuda.

<?php

define('WIDTH',100);
define('HEIGHT',100);
define('EXT','.bdgallerythumb');

if ( $_REQUEST['_a']=='thumb' )
{
$file = $_REQUEST['file'];
$thumb = $_REQUEST['file'].EXT;

if
(
file_exists($thumb)
&& filemtime($thumb)>=filemtime($file)
)
{
header('Content-type: image/jpeg');
$size = filesize($_REQUEST['file'].EXT);
$fd = fopen($_REQUEST['file'].EXT,'rb');
echo fread( $fd, $size );
fclose( $fd );
exit();
}

$imageInfo = getimagesize( $file );
switch( $imageInfo[2] )
{
case 1:
$image = imagecreatefromgif( $file );
break;
case 2:
$image = imagecreatefromjpeg( $file );
break;
case 3:
$image = imagecreatefrompng( $file );
break;
default:
exit();
}

$result = imagecreatetruecolor(WIDTH,HEIGHT);
$bg = imagecolorallocate( $result, 255, 255, 255 );
imagefilledrectangle( $result, 0, 0, WIDTH-1, HEIGHT-1, $bg );

$ratio1 = $imageInfo[0]/WIDTH;
$ratio2 = $imageInfo[1]/HEIGHT;
$ratio = $ratio1>$ratio2?$ratio1:$ratio2;
if ( $ratio<1 )
$ratio=1;
$width = $imageInfo[0]/$ratio;
$height = $imageInfo[1]/$ratio;
imagecopyresampled( $result, $image, (WIDTH-$width)/2, (HEIGHT-$height)/2, 0, 0, $width, $height, $imageInfo[0], $imageInfo[1]);

header('Content-type: image/jpeg');
imagejpeg($result);

imagejpeg($result,$thumb);

exit();
}

$supported = imagetypes();
if ( function_exists('imagecreatefromgif') )
$supported |= IMG_GIF;

$files = array();
$thumbs = array();
$dir = opendir('.');
while( ($file=readdir( $dir ))!==false )
{
if ( !is_file($file) )
continue;

$ext = strrchr($file, '.');
$extLower = strtolower($ext);
if
(
$extLower=='.gif' && ($supported & IMG_GIF)
|| $extLower=='.png' && ($supported & IMG_PNG)
|| $extLower=='.jpeg' && ($supported & IMG_JPG)
|| $extLower=='.jpg' && ($supported & IMG_JPG)
)
$files[] = $file;
else if ( $ext==EXT )
$thumbs[] = $file;
}
closedir($dir);

foreach( $files as $file )
{
$title = $file;
$size = filesize( $file );
$measure = 'B';
if ( $size>1024 )
{
$size /= 1024;
$measure = 'KB';
if ( $size>1024 )
{
$size /= 1024;
$measure = 'MB';
}
}
$title .= " - ".number_format($size,1).$measure;
?>
<a href="<?php echo $file ?>"><img src="index.php?_a=thumb&file=<?php echo $file ?>&<?php echo filemtime($file) ?>" border="1" title="<?php echo $title ?>" alt="<?php echo $title ?>"></a>
<?php
}

$extLength = strlen( EXT );
foreach( $thumbs as $thumb )
{
$file = substr( $thumb, 0, strlen($thumb)-$extLength );
if ( !file_exists($file) )
unlink($thumb);
}
?>
  #2 (permalink)  
Antiguo 03/03/2005, 10:19
kenshindark
Invitado
 
Mensajes: n/a
Puntos:
Evidentemente no es la solucion, pero... has probado a hacerlo con frames?
  #3 (permalink)  
Antiguo 03/03/2005, 17:44
 
Fecha de Ingreso: marzo-2005
Mensajes: 3
Antigüedad: 19 años, 1 mes
Puntos: 0
Ya, pero lo q quiero es aprender php... quiero sacar cual es el error del script...
  #4 (permalink)  
Antiguo 03/03/2005, 19:23
Avatar de jam1138
/** @package Moderador */
 
Fecha de Ingreso: julio-2004
Ubicación: sèveR led onieR lE
Mensajes: 9.368
Antigüedad: 19 años, 8 meses
Puntos: 102
el error??.. tu error es:
Notice: Undefined index: _a in /data/members/free/tripod/es/t/a/r/miweb/htdocs/modulares/modulos/gal/index.php on line 7
... vamos a la límea 7 y tenemos...
if ( $_REQUEST['_a']=='thumb' )
... por lo que... no recojes a _a ... extraño nombre para una variable
__________________
٩(͡๏̯͡๏)۶
» Cómo hacer preguntas de manera inteligente «

"100 años después, la revolución no es con armas, es intelectual y digital"
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 17:58.