• 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

json_encode turns array into an object

Laravel get user data with profile

PHP date() with timezone?

I want to display default profile image if user do not have profile image

Autoloading classes in PHPUnit using Composer and autoload.php

Add New Parameter to Existing URL using htaccess

*** 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

Add customer email and phone in "Order" column to admin orders list on Woocommerce

zsh: command not found: php

Store / Website Column in Magento 2 Admin Grid - Custom Module

Xdebug can't connect back to Docker host

Convert date and time to Jalali in Laravel

Issue with laravel eloquent model property

Laravel SQL query midnight time not showing

PHP | "The requested PHP extension bcmath is missing from your system."

About Contact Privacy policy Terms and conditions