function getLocalImagePath($stream_id, $req_time, $req_size = null) { $img_dir = MV_StreamImage::getLocalImageDir($stream_id); list($im_width, $im_height, $ext) = MV_StreamImage::getSizeType($req_size); $base_img = $img_dir . '/' . $req_time . '.jpg'; //print "base img: $base_img \n"; if ($req_size == null) { if (is_file($base_img)) { return $base_img; } else { //Based on settings we may do an ffmpeg call here: //@@FFMPEG call goes here: //make the call to generate the image for that time: return MV_StreamImage::genLocalStreamImage($stream_id, $req_time, $req_size); } } else { $img_file = $img_dir . '/' . $req_time . '_' . $im_width . 'x' . $im_height . '.' . $ext; //print "img with size: $img_file \n"; if (is_file($img_file)) { //print "FOUND FILE: $img_file"; return $img_file; } else { if (!is_file($base_img)) { //print "missing base img $base_img \n"; $img_file = MV_StreamImage::genLocalStreamImage($stream_id, $req_time, $req_size); if (is_file($base_img)) { //got file succesfull: //continue: } else { return false; } } //would be great to use mediaWIki's bitmap transform but not super easy to integrate... //@@todo eventually we should integrate with oggHanlder... //$thumb = Bitmap::doTransform($image) if (!MV_StreamImage::doTransformImage($base_img, $img_file, $im_width, $im_height, $ext)) { //print 'failed image transform\n'; return false; } return $img_file; } } }