Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal boa tarde estou montando uma galeria de fotos mas estou com problemas para exibir os thumbs...
Seguinte minha pagina vai exibir no canto esquerdo 1 linha com 3 thumbs e ao clicar abre a img do lado direito. (essa linha vai ser duplicada de acordo com o numero de fotos do banco. O problema é q como a linha foi feita para exibir 3 fotos se com o resultado do banco ficar 1 foto as outras duas ficam com um x (parece q a img não abriu mas na verdade não tem no banco)...
vejam a minha action ....
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/url]">](http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd)
<html xmlns="[url="[http://www.w3.org/1999/xhtml"]http://www.w3.org/1999/xhtml[/url]">](http://www.w3.org/1999/xhtml)
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
include('conecta.php');
$i=0;
$hash="$_GET[hash]";
@$pagina="$_GET[pagina]";
$busca="select * from fotos where hash='$hash'";
$total_reg = "20"; // número de registros por página
@$pagina=$pagina;
if (!$pagina) {
$pc = "1"; $pc = $pagina;
}
$inicio = $pc - 1;
$inicio = $inicio * $total_reg;
$limite = mysql_query("$busca LIMIT $inicio,$total_reg");
$todos = mysql_query("$busca");
$tr = mysql_num_rows($todos); // verifica o número total de registros
$tp = $tr / $total_reg; // verifica o número total de páginas
?>
<table align="left" width="100%" height="45"cellspacing="2" >
<?php
while ($dados = mysql_fetch_array($limite)) {
$foto1=$dados["location"];
$foto_thumb1=$dados["thumb"];
$idx1=$dados["id"];
$dados2=mysql_fetch_array($limite);
$foto2=$dados2["location"];
$foto_thumb2=$dados2["thumb"];
$idx2=$dados2["id"];
$dados3=mysql_fetch_array($limite);
$foto3=$dados3["location"];
$foto_thumb3=$dados3["thumb"];
$idx3=$dados3["id"];
?>
<tr><tr><? $nome="$_GET[nome]"; echo $nome;?></tr>
<td width="33%" height="45" align='left' valign="top" class="pontilhado_525252"><a href="centro_festas.php?acao=showimg&idx=<?php echo $idx1;?>" target='mainFrame'><a href="centro_festas.php?acao=showimg&idx=<?php echo $idx1;?>" target='mainFrame'><img src="<?php echo $foto_thumb1;?>" border='0' /></a></a></td>
<td width="33%" align='left' valign="top" class="pontilhado_525252"><?php if($dados2){?>
<?php }?>
<a href="centro_festas.php?acao=showimg&idx=<?php echo $idx2;?>" target='mainFrame'><img src="<?php echo $foto_thumb2;?>" border='0' /></a></td>
<td width="33%" align='left' valign="top" class="pontilhado_525252"><?php if($dados3){?>
<?php }?>
<a href="centro_festas.php?acao=showimg&idx=<?php echo $idx3;?>" target='mainFrame'><img src="<?php echo $foto_thumb3;?>" border='0' /></a></td>
</tr>
<?php
$i++;
}
?>
<?php
$anterior = $pc -1;
$proximo = $pc +1;
?>
<tr>
<td height="20" colspan="3" align="center"> <?php
if ($pc>1) {
echo "<a class='seta' href='?pagina=$anterior&hash=$hash'><img src='imagens/setaesq.gif' border='0'></a>";
}
if ($pc<$tp) {
echo "<a class='seta' href='?pagina=$proximo&hash=$hash'><img src='imagens/setadir.gif' border='0'></a>";
}?></td>
</tr>
</table>
</body>
</html>Carregando comentários...