• 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

PHP Find Array Index value in multi-line array

Explain how this array transposing and flattening function works

Smarty if isset

get folder directory from input type file - PHP

PHP if in_array() how to get the key as well?

How can I access an array/object?

laravel sanctum Route [login] not defined

Limit login attempts in Laravel 5.7

How to unlink image from folder?

java URL working on browser but not in client program

Redirect to previous page with php

nginx err_connection_refused, can anyone help me?

Add New Parameter to Existing URL using htaccess

How to debug in WooCommerce 3+

PHP contact form configuration [duplicate]

About Contact Privacy policy Terms and conditions