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

if (!function_exists('uploadMediumImage')) {

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