Example #1
0
function createIcon($file)
{
    if (extension_loaded('gd') && file_exists($file)) {
        return createIconGD($file);
    } else {
        return base64_decode(giftThumbnail());
    }
}
Example #2
0
function createVideoIcon($file)
{
    // @todo: Add support for video thumbnail create.
    // @see: http://stackoverflow.com/questions/14662027/generate-thumbnail-for-a-bunch-of-mp4-video-in-a-folder
    return giftThumbnail();
}
Example #3
0
function createVideoIcon($file)
{
    // @todo: Add support for video thumbnail create.
    // @see: http://stackoverflow.com/questions/14662027/generate-thumbnail-for-a-bunch-of-mp4-video-in-a-folder
    //return giftThumbnail();
    /* should install ffmpeg for the method to work successfully  */
    if (checkFFMPEG()) {
        //generate thumbnail
        $preview = sys_get_temp_dir() . '/' . md5($file) . '.jpg';
        @unlink($preview);
        //capture video preview
        $command = "ffmpeg -i \"" . $file . "\" -f image2 -vframes 1 \"" . $preview . "\"";
        exec($command);
        // Parsear la imagen
        //TODO: Make it work using libGD (see createIcon())
        return createIconGD($preview);
    } else {
        //fallback
        return giftThumbnail();
    }
}