Endroid\QrCode\QrCode::getDataUri PHP Method

getDataUri() public method

Return the data URI.
public getDataUri ( ) : string
return string
    public function getDataUri()
    {
        if (empty($this->image)) {
            $this->create();
        }
        ob_start();
        call_user_func('image' . $this->image_type, $this->image);
        $contents = ob_get_clean();
        return 'data:image/' . $this->image_type . ';base64,' . base64_encode($contents);
    }

Usage Example

コード例 #1
1
ファイル: qrcode.php プロジェクト: zhangwen9229/404-Not-Found
function qr_node($url, $sspass, $port, $method = 'aes-256-cfb')
{
    $url = $method . ":{$sspass}@" . $url . ":{$port}";
    $url = "ss://" . base64_encode($url);
    $qrCode = new QrCode();
    $qrCode->setText($url);
    $qrCode->setSize(140);
    $qrCode->setPadding(5);
    $img = $qrCode->getDataUri();
    return $img;
}
All Usage Examples Of Endroid\QrCode\QrCode::getDataUri