Dúvida Na Galeria Coppermine
#1
Posted 25/01/2006, 20:24
#2
Posted 30/01/2006, 09:30
<table width="540" cellpadding="0" cellspacing="0" class="style1">
<tr>
<?
require "conexao_cpg.php";
$sql = "select * FROM cpg133_albums ORDER BY aid DESC";
$resultado = mysql_query($sql) or die ("Erro 1: ".mysql_error());
$cont =1;
while ($linha=mysql_fetch_array($resultado)) {
$aid = $linha["aid"];//id do album
$title = $linha["title"];//titulo do album
$thumb = $linha["thumb"];//se o album tem destaque
if ($thumb == "0")//se nao tiver destaque
{
$ordem = "ORDER BY pid DESC LIMIT 1";//pega a 1ª foto do album
}
else
{
$ordem = "AND pid = '$thumb'";//pega a foto destaque se tiver
}
//===================================================
$sql_foto = "SELECT * FROM cpg133_pictures where aid = '$aid' $ordem";
$resultado_foto = mysql_query($sql_foto) or die ("Erro 1: ".mysql_error());
while ($linha=mysql_fetch_array($resultado_foto)) {
$filepath = $linha["filepath"];//pasta do album
$filename = $linha["filename"];//nome da foto destaque do album
?>
<td height="10">
<div align="center"><a href="galeria/thumbnails.php?album=<? echo $aid; ?>"><img src=mostrafoto.php?imagem=galeria/albums/<? echo $filepath.$filename; ?>&tam=120 border=0></a><br>
<strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="galeria/thumbnails.php?album=<? echo $aid; ?>"><? echo $title; ?></a></font></strong></div></td>
<?
}
if ($cont == 2)
{
echo "</tr><tr>";
$cont = 0;
}
$cont++;
}
?>
</td>
<?
}
if ($cont == 2)
{
echo "</tr><tr>";
$cont = 0;
}
$cont++;
}
?>
</tr>
</table>
mostrafoto.php
<?
header("Content-type: image/jpeg");
$alturad = $_GET['tam'];
$im = imagecreatefromjpeg($_GET['imagem']);
$largurao = imagesx($im);
$alturao = imagesy($im);
$largurad = ($largurao*$alturad)/$alturao;
$nova = imagecreatetruecolor($largurad,$alturad);
imagecopyresampled($nova,$im,0,0,0,0,$largurad,$alturad,$largurao,$alturao);
imagejpeg($nova, $novonome, 90);
imagedestroy($nova);
imagedestroy($im);
?>
WebSite: www.guiamedianeira.com.br
Profissão: WebDesigner / Programador
MSN:luciano@guiamedianeira.com.br
#3
Posted 30/01/2006, 22:17
mas gostaria de pedir mais um pouco, mudei td certo, só q tenho 2 galerias cadastradas e só a primeira aparece o thumbs, poderia dar uma olhada no codigo pra ver se eu alterei algo errado
<table width="540" cellpadding="0" cellspacing="0" class="style1">
<tr>
<?
require "conectbd.php";
$sql = "select * FROM cpg132_albums ORDER BY aid DESC";
$resultado = mysql_query($sql) or die ("Erro 1: ".mysql_error());
$cont =1;
while ($linha=mysql_fetch_array($resultado)) {
$aid = $linha["aid"];//id do album
$title = $linha["title"];//titulo do album
$thumb = $linha["thumb"];//se o album tem destaque
if ($thumb == "0")//se nao tiver destaque
{
$ordem = "ORDER BY pid DESC LIMIT 1";//pega a 1ª foto do album
}
else
{
$ordem = "AND pid = '$thumb'";//pega a foto destaque se tiver
}
//===================================================
$sql_foto = "SELECT * FROM cpg132_pictures where aid = '$aid' $ordem";
$resultado_foto = mysql_query($sql_foto) or die ("Erro 1: ".mysql_error());
while ($linha=mysql_fetch_array($resultado_foto)) {
$filepath = $linha["filepath"];//pasta do album
$filename = $linha["filename"];//nome da foto destaque do album
?>
<td height="10">
<div align="center"><a href="coppermine/thumbnails.php?album=<? echo $aid; ?>"><img src=mostrafoto.php?imagem=coppermine/albums/<? echo $filepath; ?>/<? echo $filename; ?>&tam=120 border=0></a><br>
<strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="coppermine/thumbnails.php?album=<? echo $aid; ?>"><? echo $title; ?></a></font></strong></div></td>
<?
}
if ($cont == 2)
{
echo "</tr><tr>";
$cont = 0;
}
$cont++;
}
?>
<?
{
if ($cont == 2)
{
echo "</tr><tr>";
$cont = 0;
}
$cont++;
}
?>
</td>
</tr>
</table>
1 user(s) are reading this topic
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)










