• 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

Get latest Tweets - What API

xdebug 3 not working in ubuntu 20.04 with docker

How to pass data to all views in Laravel 5?

Merge key and value of array index [duplicate]

Create a new line whenever an array value reaches more than 10 characters

WAMP Virtual Host not working

Problem with fetching data from database in Laravel

PHPExcel export HTML table to xlsx

PHP Find Array Index value in multi-line array

Execute only one time and then wait set period of time before executing again

Target Laravelista is not instantiable

Encrypt in php and decrypt in Dart(flutter)

How to create a individual template for page or post in custom plugin?

Docker & Laravel : configure: error: Package requirements (oniguruma) were not met

Laravel relationship belongsToMany with composite primary keys

About Contact Privacy policy Terms and conditions