HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/baretube.com.new/admin/functions.thumbnailing.php
<?

/**
 *  makeThumbs - Generates thumbnails for galleries
 *  
 *  @param [in] $dir Full linux path to directory full of jpegs
 *  @return void
 *  
 */
function makeThumbs($dir) {
        global $gallery_path;
        global $basepath;
        global $picthumbwidth;
        global $picthumbheight;
        global $mogrify_path;
        global $convert_path;
        global $jpegoptim_path;
        global $jpegoptim_command;
        global $basepath;
        global $ceph_enabled;
        global $ceph_delete_local;
        unset($array);
    $array = scandir($gallery_path.'/'.$dir);
        foreach($array as $i) {
                if($i != '.' && $i != '..' && !is_dir($gallery_path.'/'.$dir.'/'.$i) && (stripos($i,'.jpg') || stripos($i,'.jpeg') || stripos($i,'.gif') ||stripos($i,'.png')) ) {
                        if(!file_exists($gallery_path.'/'.$dir.'/thumbs/'.$i)) {
                                $input = $gallery_path.'/'.$dir.'/'.$i;
                $output = $gallery_path.'/'.$dir.'/thumbs/'.$i;
                shell_exec("$convert_path -auto-orient -resize ".($picthumbwidth)."x".($picthumbheight)."^ -gravity Center -extent ".$picthumbwidth."x".$picthumbheight." \"$input\" \"$output\"");

                                }
                                shell_exec("$mogrify_path -auto-orient \"$input\"");
                                if($jpegoptim_path) { shell_exec("$jpegoptim_path $jpegoptim_command \"$input\""); }
                                if($jpegoptim_path) { shell_exec("$jpegoptim_path $jpegoptim_command \"$output\""); }
                                if($ceph_enabled) {
                                  if(cephUploadObject($input, str_replace("$basepath/media/","",$input))) {
                                    if($ceph_delete_local) {
                                      if(file_exists($input)) {
                                        @unlink($input);
                                      }
                                    }
                                  }
                                  if(cephUploadObject($output, str_replace("$basepath/media/","",$output))) {
                                    if($ceph_delete_local) {
                                      if(file_exists($output)) {
                                        @unlink($output);
                                      }
                                    }
                                  }
                                }

                }
        }
}