• 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

Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables 11 [closed]

Xdebug can't connect back to Docker host

Sync Records With Default Values in Pivot Tables, Call to undefined method syncWithPivotDefaults()

Laravel 5: Is there a non-case sensitive way to sort a collection by an attribute?

woocommerce change position of price

Json_Encode not returning html even i try to encode JSON_HEX_QUOT | JSON_HEX_TAG

PHP array sort and remove duplicates by two field values

Loading data from MySQL and populating dropdown select with jQuery Mobile, PHP

How to fix Call to undefined method AppModelsTableName::factory?

Group data in a multidimensional array based on two columns

Filter WooCommerce related products by Polylang language

Creating live search with AJAX and CodeIgniter

php script to delete files older than 24 hrs, deletes all files

Get number of working days between two dates in PHP [duplicate]

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'posts.post' doesn't exist

About Contact Privacy policy Terms and conditions