Exemplo n.º 1
0
function processPage($p = 0)
{
    $tumblr = new Tumblr($_SESSION["tumblr"], "fuiKNFp9vQFvjLNvx4sUwti4Yb5yGutBN4Xh10LXZhhRKjWlV4");
    $giflib = new GifLib();
    $clean_array = $tumblr->load($p);
    $clean_array_compressed = array();
    foreach ($clean_array as $key => $post) {
        $clean_array_compressed[]["title"] = $post["title"];
        $clean_array_compressed[count($clean_array_compressed) - 1]["id"] = substr($giflib->gifOrgName($post["gif"]), 0, -4);
        if (!$giflib->isGifCached($post["gif"])) {
            if (!$giflib->isCompressionRunning($post["gif"])) {
                $giflib->compressGif($post["gif"]);
            }
            $clean_array_compressed[count($clean_array_compressed) - 1]["gif"] = "static/preloader.gif";
            #TODO auto refresh via javascript
        } else {
            $clean_array_compressed[count($clean_array_compressed) - 1]["gif"] = "gifs/compressed_" . $giflib->gifOrgName($post["gif"]);
        }
    }
    return $clean_array_compressed;
}