<?php

/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 4.8.0
 *	LISENSE: FL4HLD2A8696 - https://www.flynax.com/flynax-software-eula.html
 *	PRODUCT: Real Estate Script
 *	DOMAIN : immofil.com
 *	FILE   : PROFILETHUMBNAILUPLOADADAPTER.PHP
 *
 *	This script is a commercial software and any kind of using it must be
 *	coordinate with Flynax Owners Team and be agree to Flynax License Agreement
 *
 *	This block may not be removed from this file or any other files with out
 *	permission of Flynax respective owners.
 *
 *	Copyrights Flynax Classifieds Software | 2020
 *	https://www.flynax.com
 *
 ******************************************************************************/

use Flynax\Classes\ProfileThumbnailUpload;

/**
 * @since 4.0.0
 */
class ProfileThumbnailUploadAdapter extends ProfileThumbnailUpload
{
    /**
     * Upload image from global $_FILES massive
     * 
     * @return array
     */
    public function uploadFromGlobals()
    {
        $param_name = $this->options['param_name'] = 'image';
        $response = $this->init();

        $result = $response[$param_name][0];

        if (isset($result['error'])) {
            return ['error' => (string) $result['error']];
        }
        return ['account' => strval(RL_FILES_URL . $result['Photo'])];
    }
}
