segunda-feira, 6 de julho de 2009

PHP Inserir fotos automaticamente

<?php
                                $qtas_fotos = '12';
                                $colunas = '3';
                                $pasta = 'images/comfort/';
                                $nome_arquivo= 'foto';
                                $extensao = '.jpg';
                                $qtas_linhas = $qtas_fotos/$colunas;
                                list ($inteiro, $dizimo) = explode (".", $qtas_linhas);
                                if ($dizimo) $qtas_linhas = $inteiro+1;
                              
                                echo "<table>";
                              
                                $j=1;
                                for ($x=1; $x<=$qtas_linhas; $x++) {
                                echo "<tr>";
                                for ($i=1;$i<=$colunas;$i++) {
                               
                                if ($j>$qtas_fotos) break; // TEMOS APENAS X FOTOS...
                                echo "
                                <td align='center' style='padding:1px;'>
                                <img src='$pasta$nome_arquivo$j$extensao' />
                                </td>\n
                                ";
                              
                                $j++;
                                }
                                echo "</tr>\n";
                              
                                }
                                echo "</table>";
?>

Nenhum comentário:

Postar um comentário

Linux bash file returns unexpected token `$'do\r''

open file in vi edit with   vi filename.sh   command; type in vi  :set ff=unix  command; save file with  :wq It will save the file with unix...