';
}
function DirAndFile() {
if (!$this->pic) {
} else {
if (ereg("^/", $this->pic) or ereg("^../", $this->pic) or ereg("^./", $this->pic) or eregi("/\.\./", $this->pic) or ereg("/$", $this->pic) or !eregi(".(jpg|png|gif|jpeg)$", $this->pic)) {
echo $this->error;
die();
}
if (!eregi("[0-9]$", $this->delay)) {
echo $this->error;
die();
}
}
$this->album_dir = $this->WB_PATH . $this->pialbums ;
if (!$this->album) {
if (is_dir($this->album_dir) == '1') {
chdir($this->album_dir);
} else {
echo $this->error;
die();
}
}
// This checks for a trialing / at the end of the album name, it has to be there
elseif (ereg("^/", $this->album) or ereg("^../", $this->album) or ereg("^./", $this->album) or eregi("/\.\./", $this->album) or ereg("//$", $this->album)) {
echo $this->error;
die();
}
elseif (is_dir('' .$this->album_dir. '/' .$this->album. '') == '1') {
chdir('' .$this->album_dir. '/' .$this->album. '');
} else {
echo $this->error;
die();
}
$handle=opendir('.');
$i=0;
$j=0;
$k=0;
while ($file = readdir($handle)) {
if (is_file($file) == '1' && eregi(".(jpg|png|gif|jpeg)$", $file)) {
$get_files[$i] = array('sortby' => strtolower($file), 'real' => $file);
$i++;
} elseif (is_file($file) == '1' && eregi(".(".$this->video_formats.")$", $file)) {
$get_videos[$i] = array('sortby' => strtolower($file), 'real' => $file);
$i++;
}
// Remove the video check when we add in the video feature
elseif (is_dir($file) == '1' && $file <> '.' && $file <> '..' && $file <> 'video') {
$get_dirs[$j] = array('sortby' => strtolower($file), 'real' => $file);
$j++;
} else {
}
}
$this->get_files = $get_files;
$this->get_dirs = $get_dirs;
$this->video_files = $get_videos;
closedir($handle);
// gets the count of the pic and the prev and next thumb
if ($this->image_sort == '0') {
sort($this->get_files);
} else {
rsort($this->get_files);
}
for ($i=0; $i < count($this->get_files); $i++) {
if ($this->get_files[$i]['real'] == $this->pic) {
$this->num = $i + 1;
if ($i - 1 >= 0) {
$this->prev = substr($this->get_files[$i - 1]['real'], 0, strrpos($this->get_files[$i - 1]['real'], "."))."_thumb_$this->thumb_width".substr($this->get_files[$i - 1]['real'], strrpos($this->get_files[$i - 1]['real'], "."));
$this->prev_real = $this->get_files[$i - 1]['real'];
}
if ($i + 1 < count($this->get_files)) {
$this->next = substr($this->get_files[$i + 1]['real'], 0, strrpos($this->get_files[$i + 1]['real'], "."))."_thumb_$this->thumb_width".substr($this->get_files[$i + 1]['real'], strrpos($this->get_files[$i + 1]['real'], "."));
$this->next_real = $this->get_files[$i + 1]['real'];
}
$this->slide_start = $this->get_files[$i];
$this->slide_stop = $this->get_files[$i - 1];
}
}
// echo 'did an error post';
}
function GenerateFolders() {
if (isset($this->get_dirs) and !$this->pic) {
// check and set sort direction
if ($this->folder_sort == '0') {
sort($this->get_dirs);
} else {
rsort($this->get_dirs);
}
echo '';
for ($i=0; $i < count($this->get_dirs); $i++) {
// for ($i=0; $i < count($this->num_folder_col); $i++) {
// Check if directory is there for the cache
$cache_path='' .$this->WB_PATH. '/temp/pi_cache/' .$this->album. '' .$this->get_dirs[$i]['real']. '';
$check_cache_path=is_dir("$cache_path");
// Make sure you add this back or it won't create the cache dir
if ($check_cache_path=='1') {
} else {
mkdir ("$cache_path", 0777);
chmod ("$cache_path", 0777);
}
// Count for table columns
$j++;
if ($j == '1') {
echo '';
}
// replaces custom folder tags such as -br- with
$dir_name = str_replace($this->string_search,$this->string_subsitute,$this->get_dirs[$i]['real']);
//$dir_name = str_replace("-lb-","",$dir_name);
//$dir_name = str_replace("-rb-","",$dir_name);
echo '
' .$dir_name. ' | ';
// echo '
// ' .$this->get_dirs[$i]['real']. '
| ';
if ($j == $this->num_folder_col) {
echo ' ';
$j=0;
}
}
echo ' ';
}
}
function DisplayThumbs() {
// If text file is there and we are not viewing a picture include it
if (is_file("album.txt") == '1' && !$this->pic) {
echo '
Album description: ';
include("album.txt");
echo '
|
| ';
}
/* // I will get rid of this soon - legacy support, actually this whole fucking description setup kinda sucks
elseif (is_file(str_replace("/", "", substr(getcwd(), strrpos(getcwd(), "/"))).".txt") == '1' && !$this->pic) {
echo '
Album description: ';
include(str_replace("/", "", substr(getcwd(), strrpos(getcwd(), "/"))).".txt");
echo '
|
| ';
}*/
// $this->album <> NULL was added so pics don't display in the root of the album
// if (!$this->pic && $this->album <> NULL) {
if (!$this->pic) {
if (!$this->get_files && !$this->get_dirs) {
echo ' This folder is empty.
';
}
elseif (!$this->get_files && isset($this->get_dirs)) {
} else {
if ($this->image_sort == '0') {
sort($this->get_files);
} else {
rsort($this->get_files);
}
echo '';
// this loop will generate all the thumbs
$cache_path='' .$this->WB_PATH. '/temp/pi_cache/' .$this->album. '';
for ($i=0; $i < count($this->get_files); $i++) {
$thumb = substr($this->get_files[$i]['real'], 0, strrpos($this->get_files[$i]['real'], "."))."_thumb_$this->thumb_width".substr($this->get_files[$i]['real'], strrpos($this->get_files[$i]['real'], "."));
if (!is_file("$cache_path/$thumb") == '1') {
$file = $this->get_files[$i]['real'];
$pic_info = getimagesize($this->get_files[$i]['real']);
$ratio = $pic_info[0] / $this->thumb_width;
$new_h = $pic_info[1] / $ratio;
$x='x';
if ($this->sysOS =='1') {
$make_magick = system(''.$this->convert_path.'convert -size '.$this->thumb_width.''.$x.''.$new_h.' -geometry '.$this->thumb_width.''.$x.''.$new_h.' "'.$file.'" "'.$cache_path.''.$thumb.'"', $retval);
//$make_magick = system(''.$this->convert_path.'convert -quality 10 -size '.$this->thumb_width.''.$x.''.$new_h.' -geometry '.$this->thumb_width.''.$x.''.$new_h.' "'.$file.'" "'.$cache_path.''.$thumb.'"', $retval);
} else {
$make_magick = system(''.$this->convert_path.'convert -size '.$this->thumb_width.''.$x.''.$new_h.' -geometry '.$this->thumb_width.''.$x.''.$new_h.' "'.$file.'" "'.$cache_path.''.$thumb.'" >/dev/null 2>/dev/null', $retval);
//$make_magick = system(''.$this->convert_path.'convert -quality 10 -size '.$this->thumb_width.''.$x.''.$new_h.' -geometry '.$this->thumb_width.''.$x.''.$new_h.' "'.$file.'" "'.$cache_path.''.$thumb.'" >/dev/null 2>/dev/null', $retval);
}
// $make_magick = system(''.$this->convert_path.'convert -size '.$this->thumb_width.''.$x.''.$new_h.' -geometry '.$this->thumb_width.''.$x.''.$new_h.' "'.$file.'" "'.$cache_path.''.$thumb.'" >/dev/null 2>/dev/null', $retval);
if (!($retval)) {
chmod ("$cache_path/$thumb", 0666);
} else {
echo 'That didn\'t work as planned. (imagemagick isn\'t installed, isn\'working right, or you didn\'t make cache writable) ';
}
}
}
if(!$this->nav){
} else {
if (!eregi("[0-9]$", $this->nav)) {
echo $this->error;
die();
}
}
// this loop will display the thumbs
if (!$this->nav or $this->nav == '1') {
$nav_count = $this->dis_files;
if ($nav_count < count($this->get_files)) {
$this->nav_m = 1;
$this->nav = 1;
}
elseif ($nav_count >= count($this->get_files)) {
$nav_count = count($this->get_files);
}
$start = 0;
} else {
$nav_count = $this->nav * $this->dis_files;
if ($nav_count / count($this->get_files) > 2) {
echo $this->error;
die();
}
elseif ($nav_count >= count($this->get_files)) {
$nav_count = count($this->get_files);
$this->nav_l = 1;
} else {
$this->nav_m = 1;
$this->nav_l = 1;
}
$start = ($this->nav - 1)* $this->dis_files;
}
for ($i=$start; $i < $nav_count; $i++) {
$thumb = substr($this->get_files[$i]['real'], 0, strrpos($this->get_files[$i]['real'], "."))."_thumb_$this->thumb_width".substr($this->get_files[$i]['real'], strrpos($this->get_files[$i]['real'], "."));
$j++;
if ($j == '1') {
echo '';
}
echo '
album). '' .str_replace(" ", "%20", $thumb). '" border="1"> ' .substr($this->get_files[$i]['real'], 0, strrpos($this->get_files[$i]['real'], ".")). '
| ';
if ($j == $this->numcol) {
echo ' ';
$j=0;
}
}
echo '
';
if ($this->nav_l == '1') {
$nav_l = $this->nav - 1;
echo ' ';
}
$start_pic = $start + 1;
echo '' .$start_pic. ' - ' .$nav_count. ' of ' .count($this->get_files). '';
if ($this->nav_m == '1') {
$nav_m = $this->nav + 1;
echo ' ';
}
echo ' | ';
}
}
}
function DisplayVideo() {
if (isset($this->video_files) and !$this->pic) {
// check and set sort direction
if ($this->folder_sort == '0') {
sort($this->get_dirs);
} else {
rsort($this->get_dirs);
}
echo '';
// for ($i=0; $i < count($this->get_dirs); $i++) {
// // for ($i=0; $i < count($this->num_folder_col); $i++) {
//
// // Count for table columns
// $j++;
// if ($j == '1') {
// echo ' | ';
// }
//
// echo '
// ' .$dir_name. ' | ';
// // echo '
// // ' .$this->get_dirs[$i]['real']. '
| ';
// if ($j == $this->num_folder_col) {
// echo ' ';
// $j=0;
// }
// }
echo ' ';
}
}
function DisplayPic() {
echo '';
if (is_file($this->pic) == '1' && eregi(".(jpg|png|gif|jpeg)$", $this->pic)) {
if (!$this->prev_real) {
echo ' | ';
} else {
echo ' ';
// echo 'album). ''. str_replace(" ", "%20", $this->prev) . '" align="left" border="1">';
echo '<-prev | ';
}
$pic_info = getimagesize($this->pic);
echo 'Viewing picture ' .$this->num. ' of ' .count($this->get_files). ' ';
if ($this->allow_user_size == 'yes') {
echo '';
}
echo ' | ';
if (!$this->next_real) {
echo ' | ';
} else {
echo '';
// echo 'album). ''. str_replace(" ", "%20", $this->next). '" align="right border="1">"';
echo 'next-> | ';
}
echo '';
$cache_path='' .$this->WB_PATH. '/temp/pi_cache/' .$this->album. '';
$resampled = substr($this->pic, 0, strrpos($this->pic, "."))."_$this->resampled_width".substr($this->pic, strrpos($this->pic, "."));
$ratio = $pic_info[0] / $this->resampled_width;
$new_h = round($pic_info[1] / $ratio);
$x='x';
echo 'album). '' .str_replace(" ", "%20", $resampled). '" border="1">';
if ($this->allow_slideshow == 'yes') {
echo 'Slideshow: start -
stop Second delay:
[ 2 -
4 -
6 -
8 -
10 ] ';
}
echo ' ' .'File uploaded on: '.date("F j Y, H:i:s", filemtime("$this->pic")). '';
$size_orig = '' .$pic_info[0]. ' x ' .$pic_info[1]. ' pixels';
if ($pic_info[0] <= $this->resampled_width) {
$size_new = $size_orig;
} else {
$size_new = '' .$this->resampled_width. ' x ' .$new_h. ' pixels';
}
if (is_file("$cache_path$resampled") == '1' && eregi(".(jpg|png|gif|jpeg)$", "$cache_path$resampled")) {
nop;
}
elseif ($pic_info[0] < $this->resampled_width) {
if ($this->sysOS =='1') {
$make_magick = system(''.$this->convert_path.'convert "'.$this->pic.'" "'.$cache_path.''.$resampled.'"', $retval);
} else {
$make_magick = system(''.$this->convert_path.'convert "'.$this->pic.'" "'.$cache_path.''.$resampled.'" >/dev/null 2>/dev/null', $retval);
}
// $make_magick = system(''.$this->convert_path.'convert "'.$this->pic.'" "'.$cache_path.''.$resampled.'" >/dev/null 2>/dev/null', $retval);
if (!($retval)) {
chmod ("$cache_path$resampled", 0666);
} else {
echo 'That didn\'t work as planned. (imagemagick isn\'t installed, isn\'working right, or you didn\'t make cache writable) ';
}
} else {
if ($this->sysOS =='1') {
$make_magick = system(''.$this->convert_path.'convert -geometry '.$this->resampled_width.''.$x.''.$new_h.' "'.$this->pic.'" "'.$cache_path.''.$resampled.'"', $retval);
} else {
$make_magick = system(''.$this->convert_path.'convert -geometry '.$this->resampled_width.''.$x.''.$new_h.' "'.$this->pic.'" "'.$cache_path.''.$resampled.'" >/dev/null 2>/dev/null', $retval);
}
// $make_magick = system(''.$this->convert_path.'convert -geometry '.$this->resampled_width.''.$x.''.$new_h.' "'.$this->pic.'" "'.$cache_path.''.$resampled.'" >/dev/null 2>/dev/null', $retval);
if (!($retval)) {
chmod ("$cache_path$resampled", 0666);
} else {
echo 'That didn\'t work as planned. (imagemagick isn\'t installed, isn\'working right, or you didn\'t make picKLE-cache writable) ';
}
}
echo ' | ';
if (!$this->prev_real) {
echo ' | ';
} else {
echo '
album). ''. str_replace(" ", "%20", $this->prev) . '" align="left"
border="1"> <-prev | ';
}
echo ' ' .$this->pic. '';
// If text file is there it
if (is_file('' .$this->pic. '.txt') == '1') {
echo '
Pic description: ';
include('' .$this->pic. '.txt');
echo '
|
| ';
}
echo '' .$display2. 'Resampled size:' .$size_new. 'Original size:' .$size_orig. '';
if($this->allow_original == 'yes') {
echo 'View original';
}
echo '
| ';
} else {
if (!$this->pic) {
} else {
echo $this->error;
die();
}
}
if (!$this->next_real) {
echo ' | ';
} else {
echo '
album). ''. str_replace(" ", "%20", $this->next). '" align="right"
border="1"> next-> | ';
}
echo ' ';
}
function picKLEslide()
{
if ($this->pic) {
if (!$this->next_real) {
echo '';
} else {
echo '';
}
}
}
function picKLEfooter()
{
echo ' |