<?php
use Illuminate\Http\Request;
use Intervention\Image\ImageManager;

if (!function_exists('uploadSmallImage')) {

    /**
     * description
     *
     * @param
     * @return
     */
    function uploadSmallImage($image)
    {
    
        $relPathSmall ='/multimedia/uploads/images/promotions/';
        
        if (!file_exists(public_path($relPathSmall))) {
            mkdir(public_path($relPathSmall), 777, true);
        }
        
        $filename = time() . '.' . $image->getClientOriginalName();
        $path = $relPathSmall.'mini/'.$filename;
        (new ImageManager)
        ->make($image)
        ->resize(100, 100)
        ->save(public_path($path));
        
        return $path;
        
    }
}