• 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

phpunit - testing is painfully slow

Assign output of PHP function to a variable

Reorder attribute dropdown terms in Woocommerce single variable products

Php - Sum up the numbers in an array one by one

Testing subscription renewals on Stripe

Laravel Passport - Not able to get token string in response?

Star rating with half star support

httpd.conf on Windows: can't locate API model structure `php8_module`

Mysqli Output to a table

Extract string between first whitespace and last whitespace in php

PHP Form Not Inserting

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

Laravel Nova, route not found

Yii2: How to download backup files using spanjeta/yii2-backup?

How to pass data to all views in Laravel 5?

About Contact Privacy policy Terms and conditions