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)); }