Example #1
0
function analyze_media($media)
{
    // sementara hanya deteksi match pertama saja
    foreach ($media as $val) {
        // img?
        $ext = substr($val, -4, 4);
        if (in_array($ext, array('.jpg', '.png', '.gif'))) {
            $size = resize_image($val);
            $return = 'image^^^' . $size[0] . '^^^' . $size[1] . '^^^' . $val;
            return $return;
        } elseif (stristr($val, 'youtube')) {
            $id_youtube = get_id_youtube($val);
            $return = 'youtube^^^' . $id_youtube[1];
            return $return;
        } else {
            return 'link^^^' . $val;
        }
    }
}
function analyze_cover($val)
{
    if (stristr($val, 'youtube.com')) {
        $id_youtube = get_id_youtube($val);
        $return = $id_youtube[1];
        return $return;
    } else {
        //Todo create dom html and specific the attachment like zip an rar
        return 'link^^^' . $val;
    }
}