Viewing file: admin.php (2.84 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
include('config.php');
?>
<head>
<style>
td{font-family:Tahoma;font-size:12px;color:#000000;}
a{color:<?echo($link_color)?>; text-decoration:none;font:bold;}
a:hover{color:red}
.menu{color:#00458B;text-decoration:none;}
.quick{color:#00597D;text-decoration:none;font-size:11px;font-weight:bold;padding-top:2px;}
input,textarea, select {
color : #000000;
font: normal 11px Verdana, Arial, Helvetica, sans-serif;
border-color : #000000;
}
body {
background-color: white;
scrollbar-face-color: #DEE3E7;
scrollbar-highlight-color: #FFFFFF;
scrollbar-shadow-color: #DEE3E7;
scrollbar-3dlight-color: #D1D7DC;
scrollbar-arrow-color: #006699;
scrollbar-track-color: #EFEFEF;
scrollbar-darkshadow-color: #98AAB1;
font-family:Tahoma;font-size:12px;color:#000000;
}
th {
color: #111111; font-size: 11px; font-weight : bold;
background-color: <?echo($tb_main_color)?>; height: 25px;
}
A.nounderline
{
text-decoration: none;
font :bold
}
</style>
</head>
<?
$dir = ".";
$result = opendir($dir);
echo("<br><br><b>Admin</b><br><br>\n<form method=post action=admin.php>\n<select name=convert_dir>\n<option value=no>Please select directory\n");
while ($fn = readdir($result))
{
if ($fn != "." AND $fn != ".." AND is_dir($fn) AND !strstr($fn,'thumbnail_'))
{
if (!is_dir('thumbnail_'.$fn))
{
echo("<option value = \"$fn\">$fn\n");
}
}
}
closedir($result);
echo("</select><br><br>\n<input type=submit value=\"Make Thumbnail\">\n</fonm><br>");
echo("<br><br><br><font color=red><b> Don't Press Any Key during the Compressing</b></font>");
if (isset($_POST['convert_dir']) && $_POST['convert_dir'] != 'no')
{
$dir = $_POST['convert_dir'];
$opend = 'thumbnail_'.$dir;
@$opend_result = mkdir ($opend , 0777);
if ($opend_result)
{
$result = opendir($dir);
while ($fn = readdir($result))
{
if ($fn != "." AND $fn != ".." AND !is_dir($fn) AND stristr($fn,'jpg') )
{
// Resize Photo
//echo ($fn."<br>");
$size = getimagesize($dir."/".$fn);
//echo($size[0]." ".$size[1]."<br>");
if ($size[0] <= $width)
{
//copy
$copyfile = $opend."/".$fn;
$original_file =$dir."/".$fn;
copy($original_file , $copyfile);
}
else
{
$factor = $size[0] / $width;
$new_length = intval($size[1] / $factor);
$src_img = imagecreatefromjpeg($dir."/".$fn);
$dst_img = imagecreatetruecolor($width,$new_length);
$src_width=imagesx($src_img);
$src_height=imagesy($src_img);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $width, $new_length, $src_width, $src_height);
imagejpeg($dst_img, $opend."/".$fn, $quality);
imagedestroy($src_img);
imagedestroy($dst_img);
}
}
}
closedir($result);
echo("<br><br><b>Done!</b><br>");
}
}
?>
|