Esempio n. 1
0
function grabImage($sInputFile, $sOutputFile, $sSize = "", $iSecond = 0, $bForse = false)
{
    if (!$bForse && file_exists($sOutputFile) && filesize($sOutputFile) > 0) {
        return true;
    }
    bx_import('BxDolImageResize');
    $oImage = BxDolImageResize::instance();
    $bResult = true;
    $aSeconds = $iSecond != 0 ? array($iSecond) : array(0, 3, 5, 0);
    foreach ($aSeconds as $iSecond) {
        $bResult = convertVideoFile($sOutputFile, getGrabImageTmpl($sInputFile, $sOutputFile, $sSize, $iSecond));
        if (!$bResult) {
            continue;
        }
        $aRgb = $oImage->getAverageColor($sOutputFile);
        $fRgb = ($aRgb['r'] + $aRgb['g'] + $aRgb['b']) / 3;
        if ($fRgb > 32 && $fRgb < 224) {
            break;
        }
    }
    return $bResult;
}
Esempio n. 2
0
function grabImages($sInputFile, $sOutputFile, $iSecond = 0, $bForse = false)
{
    $sImageFile = $sOutputFile . IMAGE_EXTENSION;
    $sThumbFile = $sOutputFile . THUMB_FILE_NAME . IMAGE_EXTENSION;
    if (!$bForse && file_exists($sImageFile) && filesize($sImageFile) > 0) {
        $bResult = true;
    } else {
        $bResult = convertVideoFile($sImageFile, getGrabImageTmpl($sInputFile, $sImageFile, "", $iSecond));
    }
    if (!$bResult) {
        return false;
    }
    if (!$bForse && file_exists($sThumbFile) && filesize($sThumbFile) > 0) {
        $bResult = true;
    } else {
        $bResult = convertVideoFile($sThumbFile, getGrabImageTmpl($sInputFile, $sThumbFile, "-s " . THUMB_SIZE, $iSecond));
    }
    return $bResult;
}