protected function createFromBase64($filename, $data)
    {
        // Get temporary destination
        $destination = sys_get_temp_dir() . '/' . str_random(4) . '-' . $filename;

        // Create destination if not already there
        if (is_dir(dirname($destination)) === false) {
            mkdir(dirname($destination), 0755, true);
        }

        // Create temporary file
        file_put_contents($destination, base64_decode($data), 0);

        // Get mime type
        $mime_type = mime_content_type($destination);

        return new UploadedFile($destination, $filename, $mime_type);
    }
protected function createFromBase64($filename, $data)
    {
        // Get temporary destination
        $destination = sys_get_temp_dir() . '/' . str_random(4) . '-' . $filename;

        // Create destination if not already there
        if (is_dir(dirname($destination)) === false) {
            mkdir(dirname($destination), 0755, true);
        }

        // Create temporary file
        file_put_contents($destination, base64_decode($data), 0);

        // Get mime type
        $mime_type = mime_content_type($destination);

        return new UploadedFile($destination, $filename, $mime_type);
    }
protected function createFromBase64 ( $ filename , $ data ) { // Get temporary destination $ destination = sys_get_temp_dir ( ) . '/' . str_random ( 4 ) . '-' . $ filename ; // Create destination if not already there if ( is_dir ( dirname ( $ destination ) ) === false ) { mkdir ( dirname ( $ destination ) , 0755 , true ) ; } // Create temporary file file_put_contents ( $ destination , base64_decode ( $ data ) , 0 ) ; // Get mime type $ mime_type = mime_content_type ( $ destination ) ; return new UploadedFile ( $ destination , $ filename , $ mime_type ) ; }
Build a Torann\MediaSort\File\UploadedFile object from a
base64 encoded image array. Usually from an API request.

@param array $filename
@param array $data

@return \Torann\MediaSort\File\UploadedFile
Build a Torann \ MediaSort \ File \ UploadedFile object from a base64 encoded image array . Usually from an API request .