@@ 534-540 (lines=7) @@ | ||
531 | /** |
|
532 | * Send the HTTP header with the content-type, output the image data and die. |
|
533 | */ |
|
534 | public function show() |
|
535 | { |
|
536 | if (($string = $this->getString()) && ($mimetype = $this->getMimeType())) { |
|
537 | header('Content-Type: '.$mimetype); |
|
538 | die($string); |
|
539 | } |
|
540 | } |
|
541 | ||
542 | /** |
|
543 | * Returns the image as base64 url. |
|
@@ 547-553 (lines=7) @@ | ||
544 | * |
|
545 | * @return string|null |
|
546 | */ |
|
547 | public function base64() |
|
548 | { |
|
549 | if (($string = $this->getString()) && ($mimetype = $this->getMimeType())) { |
|
550 | $string = base64_encode($string); |
|
551 | ||
552 | return "data:{$mimetype};base64,{$string}"; |
|
553 | } |
|
554 | } |
|
555 | ||
556 | /** |