本文整理汇总了PHP中DOMPDF::get_protocol方法的典型用法代码示例。如果您正苦于以下问题:PHP DOMPDF::get_protocol方法的具体用法?PHP DOMPDF::get_protocol怎么用?PHP DOMPDF::get_protocol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOMPDF
的用法示例。
在下文中一共展示了DOMPDF::get_protocol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tempnam
function __construct(Frame $frame, DOMPDF $dompdf)
{
parent::__construct($frame);
$url = $frame->get_node()->getAttribute("src");
if (!DOMPDF_ENABLE_REMOTE && strstr($url, "://")) {
$this->_remote = false;
$this->_image_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
} else {
if (DOMPDF_ENABLE_REMOTE && strstr($url, "://")) {
// Download remote files to a temporary directory
$this->_remote = true;
$this->_image_url = tempnam(DOMPDF_TEMP_DIR, "dompdf_img_");
file_put_contents($this->_image_url, file_get_contents($url));
} else {
$this->_remote = false;
$this->_image_url = build_url($dompdf->get_protocol(), $dompdf->get_host(), $dompdf->get_base_path(), $url);
}
}
if (!is_readable($this->_image_url) || !filesize($this->_image_url)) {
$this->_remote = false;
$this->_image_url = DOMPDF_LIB_DIR . "/res/broken_image.png";
}
// We need to preserve the file extenstion
$i = strrpos($url, ".");
if ($i === false) {
throw new DOMPDF_Exception("Unknown image type: {$url}.");
}
$this->_image_ext = strtolower(substr($url, $i + 1));
}