Subversion Repositories taios

Compare Revisions

Ignore whitespace Rev 234 → Rev 241

/photos/album.php
0,0 → 1,72
<?php
 
require '../_taios.php';
 
function getImageSizes($sourceImageFilePath, $maxResizeWidth, $maxResizeHeight) {
 
$size = getimagesize($sourceImageFilePath);
$origWidth = $size[0];
$origHeight = $size[1];
 
$resizedWidth = $origWidth;
$resizedHeight = $origHeight;
if ($resizedWidth > $maxResizeWidth)
{
$aspectRatio = $maxResizeWidth / $resizedWidth;
$resizedWidth = round($aspectRatio * $resizedWidth);
$resizedHeight = round($aspectRatio * $resizedHeight);
}
if ($resizedHeight > $maxResizeHeight)
{
$aspectRatio = $maxResizeHeight / $resizedHeight;
$resizedWidth = round($aspectRatio * $resizedWidth);
$resizedHeight = round($aspectRatio * $resizedHeight);
}
return array($resizedWidth, $resizedHeight);
}
 
$page = new Taios_Page('Photo Albums', '../');
$page->drawHeader();
$page->drawMiddle();
 
$dirName = $_GET['dir'];
if (empty($dirName))
{
$page->redirect('index.php');
}
 
write('<p class="bold">Back to Photos</p><br />');
 
write('<table>');
write('<tr>');
 
$i = 0;
 
$dir = dir('albums/' . $dirName);
while (($file = $dir->read()) !== false)
{
if ($file[0] != '.')
{
if ($i >= 4)
{
write('</tr><tr>');
}
$filename = 'albums/' . $dirName . '/' . $file;
$size = getImageSizes($filename, 200, 200);
write('<td><a href="' . $filename . '"><img wdith="' . $size[0] . '" height="' . $size[1] . '" src="' . $filename . '" /></a></td>');
$i++;
}
}
 
write('</tr>');
write('<table>');
 
$page->drawFooter();
 
?>
 
/photos/index.php
11,7 → 11,10
$dir = dir('albums/');
while (($file = $dir->read()) !== false)
{
write('<p><a href="album.php?dir=' . $file . '">' . $file . '</a></p>');
if ($file[0] != '.')
{
write('<p><a href="album.php?dir=' . $file . '">' . $file . '</a></p>');
}
}
 
$page->drawFooter();