2017 © Pedro PelĂĄez
 

library file2base64

File to base64.

image

wuyumin/file2base64

File to base64.

  • Sunday, October 15, 2017
  • by wuyumin
  • Repository
  • 1 Watchers
  • 2 Stars
  • 75 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 29 % Grown

The README.md

[PHP] file to base64

中文说明, (*1)

base64 files are used for embedding in web pages., (*2)

Usage:

install in Composer, (*3)

composer require wuyumin/file2base64, (*4)

php code, (*5)

require __DIR__ . '/../vendor/autoload.php';

use File2base64\File2base64;

$file2base64 = new File2base64();
# $file2base64 = new File2base64(['bmp' => 'image/bmp']);

$file2base64->toFile('file2base64.png', 'file2base64.txt');
# echo $file2base64->toBase64('file2base64.png');

Laravel Framework

(tips:Laravel 5.5+ can ignore step 2、3,version 5.5+ support to register automatically) 1. Composer install composer require wuyumin/file2base64 2. (ServiceProvider)add the follow line to the section providers of config/app.php
File2base64\Laravel\ServiceProvider::class,, (*6)

  1. (Facades)add the follow line to the section aliases of config/app.php(optional)
    'File2base64' => File2base64\Laravel\Facade::class,

Result:

base64 file string, (*7)

data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==

HTML code use like this:

html code, (*8)

<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="">

web page demo: All in one page with base64 audio,no web link with audio file, (*9)

Supported Type:

.png、.jpg、.jpeg、.gif、.ico、.mp3、.ogg, (*10)

You can init for other type use array., (*11)

$file2base64 = new File2base64(['bmp' => 'image/bmp']);, (*12)

The Versions

15/10 2017

dev-master

9999999-dev https://github.com/wuyumin/File2base64

File to base64.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel base64 file2base64 filetobase64 file to base64 yumin wu wuyumin

15/10 2017

v0.3.0

0.3.0.0 https://github.com/wuyumin/File2base64

File to base64.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel base64 file2base64 filetobase64 file to base64 yumin wu wuyumin

15/10 2017

v0.2.0

0.2.0.0 https://github.com/wuyumin/File2base64

File to base64.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

laravel base64 file2base64 filetobase64 file to base64 yumin wu wuyumin

14/10 2017

v0.1.0

0.1.0.0 https://github.com/wuyumin/File2base64

File to base64.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

base64 file2base64 filetobase64 file to base64