Returns screenshot of current page as binary string.

@param bool $asBase64 - return base64 data, "as is" from server

@return string;
768860
public function screenshotAsImage($asBase64 = false)
    {
        $image = $this->getDriver()->curl(
            $this->getDriver()->factoryCommand('screenshot', WebDriver_Command::METHOD_GET)
        );
        $image = $image['value'];
        if (!$asBase64) {
            $image = base64_decode($image);
        }
        return $image;
    }
839553
function load_base64($base64string) {
        if (!extension_loaded('gd')) {
            throw new Exception('Required extension GD is not loaded.');
        }
        //remove data URI scheme and spaces from base64 string then decode it
        $this->imagestring = base64_decode(str_replace(' ', '+', preg_replace('#^data:image/[^;]+;base64,#', '', $base64string)));
        $this->image = imagecreatefromstring($this->imagestring);
        return $this->get_meta_data();
    }
672409
public function outputBase64($quality = null)
    {
        ob_start();
        $this->save(-1, $quality);
        $image_data = ob_get_contents();
        ob_end_clean();

        return 'data:' . $this->original_info['mime'] . ';base64,' . base64_encode($image_data);
    }
365910
public static function getBaseUrl()
    {
        $protocol = isset($_SERVER['HTTPS']) ? 'https' : 'http';
        $url = $protocol . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'];

        // cut at last '/' (we dont want to see index.php)
        return substr($url, 0, strrpos($url, '/'));
    }
518451
public function isBase64()
    {
        if (!is_string($this->data)) {
            return false;
        }

        return base64_encode(base64_decode($this->data)) === $this->data;
    }
665687
public static function base64UrlSafeDecode($s)
    {
        $s = str_replace('_', '/', $s);
        $s = str_replace('-', '+', $s);
        $s = base64_decode($s);
        return ($s);
    }
90671
public function getHTMLBodyWithEmbeddedBase64Images() {
        return $this->getCustomHTMLBody(function($body, $oAttachment){
            /** @var \Webklex\IMAP\Attachment $oAttachment */
            if ($oAttachment->id && $oAttachment->getImgSrc() != null) {
                $body = str_replace('cid:'.$oAttachment->id, $oAttachment->getImgSrc(), $body);
            }

            return $body;
        });
    }
944580
public function asText(bool $extended = false): string {
        $event = new OutputOpEvent($this, ['extended' => $extended]);
        $this->fireOperationEvent(OutputOpEvent::AS_TEXT_EVENT, $event);
        return $event->getResults();
    }
373218
public function base64Decode(string $base64Encoded): string
    {
        if ($remainder = strlen($base64Encoded) % 4) {
            $base64Encoded .= str_repeat('=', 4 - $remainder);
        }

        return base64_decode(strtr($base64Encoded, '-_', '+/'));
    }
110547
public function getBaseImageUrl(): string
    {
        return $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA);
    }
628441
public function toBase64() {
        ob_start ();
        $this->saveAs();
        $data = ob_get_contents();
        ob_end_clean();
        return 'data:image/'.$this->realType.';base64,'.base64_encode($data);
    }
641145
public function getBinary(): string
    {
        if (is_null($this->bin)) {
            $paths = array('/usr/bin/assimp', '/usr/local/bin/assimp', '~/bin/assimp');
            foreach ($paths as $path) {
                try {
                    $this->setBinary($path);
                } catch (\InvalidArgumentException $e) {}
            }

            if (!$this->bin) {
                throw new \RuntimeException('assimp-binary not found in '.explode(', ', $paths), ErrorCodes::FILE_NOT_FOUND);
            }

            if (!is_executable($this->bin)) {
                throw new \RuntimeException('Found a binary file, but it is not executable: '.$this->bin, ErrorCodes::FILE_NOT_EXECUTABLE);
            }
        }
        return $this->bin;
    }
816216
static function base($url = '', $cacheBuster = false) {
        $cacheb = $cacheBuster ? ('?' . (Config::get('app.version', '1.0.0'))) : ''; 
        $servern = $_SERVER['SERVER_NAME']; 
        $serverp = $_SERVER['SERVER_PORT'];
        $server = $serverp == '8080' || $serverp == '80' || $serverp == '443' ? $servern : "$servern:$serverp";

        return (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ||
                (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on'))
                    ? 'https://' : 'http://') . str_replace('//', '/', ($server . '/' . $url)) . $cacheb;
    }
1007419
function decodeBase64WebPDataURL(url) {
            if (typeof url !== "string" || !url.match(/^data:image\/webp;base64,/i)) {
                return false;
            }
            
            return window.atob(url.substring("data:image\/webp;base64,".length));
        }
1176045
final public function imageAsString($as = null)
	{
		$image = $this->imageAsDOMElement($as);
		return $image->ownerDocument->saveHTML($image);
	}
1295952
public function getData($encoded = true, $asResource = true)
    {
        $resource = fopen('php://temp', 'rb+');

        if ($encoded) {
            $filter = stream_filter_append($resource, 'convert.base64-encode', STREAM_FILTER_WRITE);
        }

        $this->copyStreamToStream($this->resource, $resource);

        if (isset($filter)) {
            stream_filter_remove($filter);
        }

        if ($asResource) {
            return $resource;
        }

        $content = stream_get_contents($resource);
        fclose($resource);

        return $content;
    }
1077403
public function getBaseUrl($absolute = false)
    {
        $url = array();
        if ($absolute) {
            $url[] = $this->baseUrl !== null ? rtrim($this->baseUrl, '/') : Yii::app()->request->baseUrl;
        }
        $url[] = $this->fileDir;
        return rtrim(implode('/', $url), '/');
    }