brbunny/bruploader

It is a base64 upload manager for PHP with ease and security

v1.0.1 2021-03-01 15:48 UTC

This package is auto-updated.

Last update: 2024-05-06 22:01:33 UTC


README

Maintainer PHP from Packagist Latest Version Software License Total Downloads

It is a base64 upload manager for PHP with ease and security

Installation

BrUploader is available through Composer:

"brbunny/bruploader": "1.0.*"

or run

composer require brbunny/bruploader

Documentation

BrUploader is a component made based on the Uploader library. It aims to facilitate the upload of images in base64 format.

For more details on how to use it, see an example folder in the component directory. It will have an example of use.

BrUploader é um componente feito com base na biblioteca Uploader. Visa facilitar o upload de imagens no formato base64.

Para obter mais detalhes sobre como usá-lo, consulte uma pasta de exemplo no diretório do componente. Terá um exemplo de uso.

Initialization

For details on how to use the upload, see a sample folder in the component directory. In it you will have an example of use for each class. BrUploader works like this:

Para mais detalhes sobre como usar o upload, veja uma pasta de exemplo no diretório do componente. Nela terá um exemplo de uso para cada classe. BrUploader funciona assim:

Upload Image
<?php

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

$image = new \BrBunny\BrUploader\Base64("uploads", "images");

// $_POST['image'] => Base64 string of the image

if ($_POST && $_POST['image']) {
    try {
        $upload = $image->upload($_POST['image'], $_POST['name']);
        echo "<img src='{$upload}' width='100%'>";
    } catch (Exception $e) {
        echo "<p>(!) {$e->getMessage()}</p>";
    }
}
Remove Image
<?php

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

use BrBunny\BrUploader\Base64;

// $_GET['path'] => Image path

if ($_GET && $_GET['path']) {
   Base64::remove($_GET['path']);
}

Credits

License

The MIT License (MIT). Please see License File for more information.