• 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

Add restriction to WooCommerce coupons by allowed user ID

wp_remote_get() not passing authentication

Symfony process run throws exception - executing on command line works

Access relation of pivot table in Laravel

How to get AJAX to post on second page?

Android Volley getParams() method not getting called for JsonObjectRequest

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

"Mixed content blocked" when running an HTTP AJAX operation in an HTTPS page

CodeIgniter extend CI_URI undefined method

Call to a member function fetch_field() on a non-object MySQLiDB

Send Outlook 2010 email using PHP

Laravel Mix Uncaught ReferenceError: $ is not defined

Failing validation doesn't stop code execution in livewire component

how to see if database exists with PDO [duplicate]

MongoDB Duplicate Documents even after adding unique key

About Contact Privacy policy Terms and conditions