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/cli/regenAllVideoThumbs.php
<?

require("../../mb.php");
require_once("$basepath/admin/getid3/getid3.php");

$id = (int) $_GET['id'];

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];
    $subdir = $first . '/' . $second . '/' . $third . '/' . $forth . '/' . $fifth . '/';
    $target_movie = $video_path . "/" . $subdir . $i;
    $rrow[id] = uniqid();
    if (1) {
        $getID3 = new getID3;
        $ThisFileInfo = $getID3->analyze("$video_path/$subdir" . $row[filename]);
        $reallengthid3 = $ThisFileInfo['playtime_string'];
        $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($basepath.'/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);
                    shell_exec("$ffmpeg_path -ss $first -i \"" . "$video_path/$subdir" . $row['filename'] . "\" -vcodec mjpeg -vframes 1 -an -f rawvideo -s " . $thumbwidth . "x" . $thumbheight . " \"$target_image\"");
                    shell_exec("$ffmpeg_path -ss $first -i \"" . "$video_path/$subdir" . $row['filename'] . "\" -vcodec mjpeg -vframes 1 -an -f rawvideo \"$target_imageb\"");

                    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");
                    }
                }
                $first = $first + $interval;
            }
        }
        echo "Success!\n\n";
        $counter++;
    }
}


echo "\n----------------------\nComplete";
?>