• 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

could not find driver Debian SQL Server PHP

SendGrid: Sending an email to multiple recipients without other emails being shown on the "to" field

Add Metadata, headers (Expires, CacheControl) to a file uploaded to Amazon S3 using the Laravel 5.0 Storage facade

Remove country code from phone number?

Adding custom body class to the custom archive pages

Using array_intersect on a multi-dimensional array

Explain how this array transposing and flattening function works

How to remove index.php and index from the URL using htaccess | PHP

Best way to scrolldown onpageload

Composer Curl error 60: SSL certificate problem: unable to get local issuer certificate

Laravel Collections. Is there some kind of assertStructure method?

How to set a domain name with php artisan serve

Adding the custom page with add_menu_page function on Wordpress

laravel MVC execution flow

Last order would be re-order in wooCommerce. How is it possible?

About Contact Privacy policy Terms and conditions