• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

PHP: How to solve ob_start() in combination imagepng() issue?

phpoutput-buffering


PHP Snippet 1:

imagepng($imgSignature, 'php://memory/file.png');
$base64Signature = base64_encode(file_get_contents('php://memory/file.png'));

PHP Snippet 2:

ob_start();
imagepng($imgSignature);
imagedestroy($imgSignature);
$data = ob_get_contents();
ob_end_clean();
$data = base64_encode($data);

Related Snippets

Is there a way to correctly use sanitize_text_field and wp_unslash that doesn't cause psalm to error with "expects string, possibly different type"

PHP how to detect if running on arm64 cpu?

PHP my timezone is no setting up in PHP.ini File in xampp

PHP Slim Framework request using withAttribute error

PHP rotate matrix counter-clockwise

What is PHP's equivalent of JavaScript's "array.every()"?

Fatal error: [] operator not supported for strings

Having issue with matching rows in the database using PDO

Laravel/docker-compose/redis - Class 'Redis' not found

backup files to google drive using PHP

Laravel UUID generation

Show date difference as "20" instead of "20 years ago"

Return multiple values from a function using mysqli_fetch_assoc [closed]

WordPress - Dynamically add user ID to the end of a URL

Warning file_get_contents () failed to open stream: HTTP request failed! HTTP/1.0 402 Payment Required

About Contact Privacy policy Terms and conditions