~www
22 itemsDownload ./*

..
backdoor
chat
comment
css
img
js
php
s
three-fbx-loader
thumbs
.htaccess
analytics.log
dl.php
favicon.gif
favicon.ico
favicon_red.ico
ffthumber.php
index.php
index.reimagined.php
randomskeleton.php
twily-reimagined.sh
visits


wwwffthumber.php
2 KB• 16•  1 week ago•  DownloadRawClose
1 week ago•  16

{}
<?php

    $root=$_SERVER['DOCUMENT_ROOT'];

    $path="";
    $hash="";
    $idx="";
    if(isset($_GET['p'])) {
        $path=stripslashes(htmlspecialchars($_GET['p']));
        $hash=md5($path);
        $idx=stripslashes(htmlspecialchars($_GET['i']));
    }
    $path="s/".$path;

    $arr=array(
        "path" => $path,
        "thumb" => "thumbs/".$hash.".jpg",
        "idx" => $idx
    );
    $fullpath=$root."/".$arr['path'];
    $fullthumb=$root."/".$arr['thumb'];
    //echo "do file: ".$root.$path."<br />";
    //echo "output: ".$root."thumbs/".$hash.".jpg"."<br />";
    //echo "idx: ".$idx."<br />";

    //echo $fullpath;
    //exit;
    //if($hash!="d41d8cd98f00b204e9800998ecf8427e") { // empty
    //
    //}

    if(file_exists($fullpath)) {
        $mime=mime_content_type("$fullpath");
        $size=512;

        if($mime=="image/jpeg" || $mime=="image/png" || $mime=="image/gif") {
            //exec("/usr/local/bin/ffmpeg -i 'files/$fileName' -vf scale=200:-1 'thumbs/$fileName.jpg' -y");
            exec("ffmpeg -i '$fullpath' -vf \"scale='trunc(min(1,min($size/iw,$size/ih))*iw/2)*2':'trunc(min(1,min($size/iw,$size/ih))*ih/2)*2'\" '$fullthumb' -y");
        } else {
            //exec("/usr/local/bin/ffmpeg -i 'files/$fileName' -vcodec mjpeg -vframes 1 -vf scale=200:-1 -an -f rawvideo 'thumbs/$fileName.jpg' -y");
            exec("ffmpeg -i '$fullpath' -vcodec mjpeg -vframes 1 -vf \"scale='trunc(min(1,min($size/iw,$size/ih))*iw/2)*2':'trunc(min(1,min($size/iw,$size/ih))*ih/2)*2'\" -an -f rawvideo '$fullthumb' -y");
        }

        
        echo json_encode($arr,JSON_FORCE_OBJECT);
    }

?>

Top
©twily.info 2013 - 2025
twily at twily dot info



2 194 758 visits
... ^ v