• 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

Yii2: How do I debug console commands?

PHP to search within txt file and echo the whole line

How to read laravel_session cookies saved in cookie memory of browser in client side?

How do I do HTTP basic authentication using Guzzle?

Statement that checks whether a URL contains a particular path?

Add New Parameter to Existing URL using htaccess

Load a .env file with PHP

api response laravel doesn't show

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

How can I make Laravel return a custom error for a JSON REST API

How can I get new CSRF token in LARAVEL by using ajax

Yii2 redirecting to previous page after login

Reorder attribute dropdown terms in Woocommerce single variable products

Error converting docx to pdf using Unoconv

Reducing authentication calls on external API (Laravel 5.6)

About Contact Privacy policy Terms and conditions