• 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

Any AWS EB Laravel route getting 404 Not Found nginx/1.16.1

MySQL - Connection failed: No route to host

(Laravel) How to delete multiple models including optional relationships?

PHP returning an error message and false

*** ERROR *** The PHP configuration loaded file is: c:/wamp64/bin/php/php8.1.0/php.ini - should be: c:/wamp64/bin/apache/apache2.4.53.1/bin/php.ini

CONCAT columns with Laravel 5 eloquent

Laravel after login Two factor not working

How to make autocomplete work in foreach php loop? (vscode, intellisense)

Hi, I am making a contact form thingy, and my php isn't working any reason why?

Two buttons one form

Display the default discounted price and percentage on Woocommerce products

PHP Include for HTML?

Get sql.h error on MacOS 12 (Monterey) sqsrv and pdo_sqsrv drive installation

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

Unable to match results of php hash_hmac() and coldfusion hmac()

About Contact Privacy policy Terms and conditions