Yii网络摄像头扩展


Yii webcam extension

在Yii中,我使用用于在我的应用程序中拍摄照片的Yii -jpegcam网络摄像头扩展,它与以下url格式配合良好

index.php?r=user/newphoto

但是我的应用程序是在"/"格式(index.php/user/newphoto)。所以这个扩展不与我的url格式工作。如何解决?

 Extension Link used : http://www.yiiframew...on/yii-jpegcam/
http://www.yiiframework.com/extension/yii-jpegcam/
我的视图代码是:
<?php $onBeforeSnap = "document.getElementById('upload_results').innerHTML = '<h1>Uploading...</h1>';";
      $completionHandler = <<<BLOCK
        if (msg == 'OK') {
            document.getElementById('upload_results').innerHTML = '<h1>OK! ...redirecting in 3 seconds</h1>';
            // reset camera for another shot
            webcam.reset();
            setTimeout(function(){window.location = "index.php?r=user/index";},3000);
        }
        else alert("PHP Error: " + msg);
BLOCK;
      $this->widget('application.extensions.jpegcam.EJpegcam', array(
            'apiUrl' => 'index.php?r=user/jpegcam.saveJpg',
            'shutterSound' => false,
            'stealth' => true,
            'buttons' => array(
                'configure' => 'Configure',
                'takesnapshot' => 'Take Snapshot!'
            ),
            'onBeforeSnap' => $onBeforeSnap,
            'completionHandler' => $completionHandler
        )); ?>

如果在配置中启用了urlManager,您应该使用createUrl方法更改apiUrl值:

$this->widget('application.extensions.jpegcam.EJpegcam', array(
        'apiUrl' => Yii::app()->urlManager->createUrl('index.php/user/jpegcam.saveJpg'),
        'shutterSound' => false,
        'stealth' => true,
        'buttons' => array(
            'configure' => 'Configure',
            'takesnapshot' => 'Take Snapshot!'
        ),
        'onBeforeSnap' => $onBeforeSnap,
        'completionHandler' => $completionHandler
    ));