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/freecams1.com/public_html/admin/regenallthumbs.php
<?
include_once('db.php');
require_once('getid3/getid3.php');
$id = (int) $_GET['id'];
$imagick_command = "-modulate 110,102,100 -sharpen 1x1 -enhance";
if (is_odd($thumbwidth)) {
    $thumbwidth++;
}
if (is_odd($thumbheight)) {
    $thumbheight++;
}
$result = dbQuery("SELECT * FROM content WHERE approved = 2 AND hotlinked NOT LIKE '%adultcentro%'", false);
foreach ($result as $row) {
    $i = $row['filename'];
    $first = $row['filename'][0];
    $second = $row['filename'][1];
    $third = $row['filename'][2];
    $forth = $row['filename'][3];
    $fifth = $row['filename'][4];
	@mkdir($video_path.'/'.$first); 
	@mkdir($video_path.'/'.$first.'/'.$second); 
	@mkdir($video_path.'/'.$first.'/'.$second.'/'.$third); 
	@mkdir($video_path.'/'.$first.'/'.$second.'/'.$third.'/'.$forth);
	@mkdir($video_path.'/'.$first.'/'.$second.'/'.$third.'/'.$forth.'/'.$fifth);
	@mkdir($thumb_path.'/'.$first); 
	@mkdir($thumb_path.'/'.$first.'/'.$second); 
	@mkdir($thumb_path.'/'.$first.'/'.$second.'/'.$third); 
	@mkdir($thumb_path.'/'.$first.'/'.$second.'/'.$third.'/'.$forth);
	@mkdir($thumb_path.'/'.$first.'/'.$second.'/'.$third.'/'.$forth.'/'.$fifth);
    $subdir = $first . '/' . $second . '/' . $third . '/' . $forth . '/' . $fifth . '/';
    $target_movie = $video_path . "/" . $subdir . $i;
    $rrow[id] = uniqid();
	 if($row['hotlinked'] && !file_exists("$video_path/$subdir" . $row['filename'])) {
        shell_exec("$wget_path " . escapeshellarg(str_replace('\r', '', $row[hotlinked])) . " -U=\"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)\" -O \""."$video_path/$subdir" . $row['filename']."\"");
    }

    if (1) {
        $getID3 = new getID3;
        $ThisFileInfo = $getID3->analyze("$video_path/$subdir" . $row[filename]);
        $reallengthid3 = $ThisFileInfo['playtime_string'];
		
		$movie_width = $ThisFileInfo['video']['resolution_x'];
        $movie_height = $ThisFileInfo['video']['resolution_y'];		
        $thisarray = explode(':', $reallengthid3);
        $length = ($thisarray[0] * 60) + $thisarray[1];
        if ($numFrames == 0) {
            $numFrames = $length * 15;
        }
        dbReconnect();
        dbQuery("UPDATE content SET length = '$length' WHERE record_num = '$rrow[id]'");
        $dirname = str_replace('.flv', '', $row['orig_filename']);
        @mkdir('../media/thumbs/' . $subdir . $dirname);
        //create thumbnails
        echo "Total Length: $length\n";
        $interval = floor($length / 13);
        $first = 1;
        for ($i = 0; $i < 11; $i++) {
            if ($first) {
                $target_image = "$thumb_path/$subdir$dirname/" . $row['orig_filename'] . "-$i.jpg";
                $target_imageb = "$thumb_path/$subdir$dirname/" . $row['orig_filename'] . "-$i" . "b" . ".jpg";
                if ($length) {
                    echo "Creating thumb #$i at second: $first...";
                    unlink($target_image);
                    unlink($target_imageb);
					
					if ($movie_height > $movie_width) {
						shell_exec("$ffmpeg_path -ss $first -i \"" . "$video_path/$subdir" . $row['filename'] . "\" -vcodec mjpeg -vframes 1 -an -filter_complex '[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16' -f rawvideo -s " . $thumbwidth . "x" . $thumbheight . " \"$target_image\"");
						if($jpegoptim_path) { shell_exec("$jpegoptim_path $jpegoptim_command \"$target_image\""); } 
						shell_exec("$ffmpeg_path -ss $first -i \"" . "$video_path/$subdir" . $row['filename'] . "\" -vcodec mjpeg -vframes 1 -an -filter_complex '[0:v]scale=ih*16/9:-1,boxblur=luma_radius=min(h\,w)/20:luma_power=1:chroma_radius=min(cw\,ch)/20:chroma_power=1[bg];[bg][0:v]overlay=(W-w)/2:(H-h)/2,crop=h=iw*9/16' -f rawvideo \"$target_imageb\"");
						if($jpegoptim_path) { shell_exec("$jpegoptim_path $jpegoptim_command \"$target_imageb\""); } 
					} else {
						shell_exec("$ffmpeg_path -ss $first -i \"" . "$video_path/$subdir" . $row['filename'] . "\" -vcodec mjpeg -vframes 1 -an -f rawvideo \"$target_imageb\"");
                        shell_exec("$convert_path -auto-orient -resize ".($thumbwidth)."x".($thumbheight)."^ -gravity Center -extent ".$thumbwidth."x".$thumbheight." \"$target_imageb\" \"$target_image\"");
                        if($jpegoptim_path) { shell_exec("$jpegoptim_path $jpegoptim_command \"$target_imageb\""); }
                        if($jpegoptim_path) { shell_exec("$jpegoptim_path $jpegoptim_command \"$target_image\""); }
					}
								
                    if (file_exists($target_image)) {
                        echo "Success!\n";
                    } else {
                        echo "Failure! Unable to create thumbnail!\n";
                    }
                    if (file_exists("/usr/local/bin/mogrify")) {
                        shell_exec("/usr/local/bin/mogrify $imagick_command $target_image");
                    } else {
                        shell_exec("/usr/bin/mogrify $imagick_command $target_image");
                    }
					
					//transfer to ceph storage and remove if needed.
					if($ceph_enabled) { 
						if(cephUploadObject($target_image,str_replace("$basepath/media/","",$target_image))) {
							if($ceph_delete_local) { 
								if(file_exists($target_image)) { 
									unlink($target_image); 
								}
							}
						}
						if(cephUploadObject($target_imageb,str_replace("$basepath/media/","",$target_imageb))) {
							if($ceph_delete_local) { 
								if(file_exists($target_imageb)) { 
									unlink($target_imageb); 
								}
							}
						}
					}
					
					if($deleteHotlinkedVideos && $row['hotlinked']) { 
						unlink("$video_path/$subdir".$row['filename']);
					}
                }
                $first = $first + $interval;
            }
        }
        echo "Success!\n\n";
        $counter++;
    }
}
echo "\n----------------------\nComplete";
?>