<?
# Slashster: Open Source Friend of a Friend Software
# Copyright 2004 Mark El-Wakil
# Contact: hide@address.com
# http://seventhcycle.net
#
# This file is part of Slashster.
#
# Slashster is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Slashster is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Slashster; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import_request_variables("gPc");
require("PageClass.php");
$mpage = new PageClass("authonly");
$mpage->MembersOnly();
$sql = "select * from UserTable where Id = \"$id\"";
$r = $mpage->DoQuery($sql,1);
if (!sizeof($r)) exit;
$r = $r[0];
$sql = "SELECT * FROM UserPics where Userid = \"$id\" order by Id";
$qu = $mpage->DoQuery($sql,1); // qryUsers
$mpage->Initialize("authremainder");
?>
<center>
<div style="width:480px" align="left">
<BR>
<? if ($r[Id] == $mpage->IdNum) { ?>
<span class="title1">Your Pictures</span>
<? } else { ?>
<span class="title1"><?= $r[Fname] ?>'s Pictures</span>
<? } ?>
<BR>
<? if ($r[Id] == $mpage->IdNum) { ?>
<small>[<a href="editphotos.php">Edit Photos</a>]</small>
<? } ?>
<? if ($r[Id] == $mpage->IdNum) { ?>
<small>[<a href="user.php">Go Back to Your User Page</a>]</small>
<? } else { ?>
<small>[<a href="user.php?id=<?= $r[Id] ?>">Go Back to <?= $r[Fname] ?>'s User Page</a>]</small>
<? } ?>
<BR><BR>
</div>
<table border=1 width=480 bordercolor=black cellspacing=0>
<? for ($x = 0; $x < sizeof($qu); $x++)
{
$q = $qu[$x];
if ($x % 4 == 0) echo "<tr>";
?>
<td width=120 align=center>
<? if ($r[PicDefault] == $q[Id]) { ?>
<B>Primary Photo</b>
<? } ?>
<BR>
<B>"<?= $q[Descr] ?>"</b>
<BR><a href="/userpics/<?= $mpage->PicPr($q[Id], $q[Userid]) ?>-a.jpg" target="_blank"
><img width=80 height=60 border=0 src = "/userpics/<?= $mpage->PicPr($q[Id], $q[Userid]) ?>-b.jpg"></a>
<BR>
<small>[ <a href="/userpics/<?= $mpage->PicPr($q[Id], $q[Userid]) ?>-a.jpg" target="_blank"
>View Full Photo</a> ]</small>
</td>
<?
if ($x % 4 == 3) echo "</tr>";
}
for ($x; $x % 4 != 0; $x++)
{ ?>
<td> </td>
<?
if ($x % 4 == 3) echo "</tr>";
}
?>
</table>
<BR><BR>
</center>
<?
$mpage->ClosePage();
function CreateThumb($src, $crop, $ima_w=80, $ima_h=60)
{
$im = imagecreatefromstring($src);
$im_h = ImageSY($im);
$im_w = ImageSX($im);
$aspect = ($im_h / $im_w);
$aspect_i = ($ima_h / $ima_w);
$ima = ImageCreateTrueColor($ima_w, $ima_h);
$dstw = ($im_h / $aspect_i);
$dsth = ($im_w * $aspect_i);
if ($crop)
{
if ($aspect > $aspect_i)
{
$isw = $ima_h / $aspect;
$is = ($ima_w - $isw) / 2;
ImageCopyResampled($ima, $im,
$is, 0, // dstX, dstY should be 0, 0
0, 0, // srcX, srcY 0, eq
$isw, $ima_h, // dstW, dstH should be $ima_w, $ima_h
$im_w, $im_h); // srcW, srcH 0, eq
}
else
{
$ish = $ima_w * $aspect;
$is = ($ima_h - $ish) / 2;
ImageCopyResampled($ima, $im,
0, $is, // dstX, dstY should be 0, 0
0, 0, // srcX, srcY 0, eq
$ima_w, $ish, // dstW, dstH should be $ima_w, $ima_h
$im_w, $im_h); // srcW, srcH 0, eq
}
} else {
if ($aspect > $aspect_i)
{
ImageCopyResampled($ima, $im,
0, 0, // dstX, dstY should be 0, 0
0, ($im_h - $dsth) / 4, // srcX, srcY 0, eq
$ima_w, $ima_h, // dstW, dstH should be $ima_w, $ima_h
$im_w, $dsth); // srcW, srcH 0, eq
}
else
{
ImageCopyResampled($ima, $im,
0, 0,
($im_w - $dstw) / 2, 0,
$ima_w, $ima_h,
$dstw , $im_h);
}
}
ob_start();
ImageJPEG($ima);
$php = ob_get_contents();
ob_end_clean();
ImageDestroy($im);
ImageDestroy($ima);
return $php;
}
?>