1. Go to this page and download the library: Download amirsahra/illustrator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
amirsahra / illustrator example snippets
// Upload the image with the default values set in the config file of this package
Illustrator::upload($request->imageFieldName);
// Upload the image to the desired directory
Illustrator::setDir('images/users')->upload($request->imageFieldName);
// Upload the image to the desired name
Illustrator::setName('myDesiredName')->upload($request->imageFieldName);
// Upload the image to the desired disk
Illustrator::setDisk('public')->upload($request->imageFieldName);
//You can use this method together, but the upload method must be at the end.
Illustrator::setDisk('public')
->setName('myDesiredName')
->setDir('images/users')
->upload($request->imageFieldName);
namespace App\Http\Controllers;
use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
class HomeController extends Controller
{
public function uploadImage(Request $request)
{
$imgPath = Illustrator::upload($request->imageInput);
MyImage::create([
'path' => $imgPath
]);
return Redirect::back()->with(['msg' => 'successfully']);
}
}
namespace App\Http\Controllers;
use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
class HomeController extends Controller
{
public function uploadImage(Request $request)
{
$imgPath = Illustrator::setDir('myDirectory/images')->upload($request->imageInput);
MyImage::create([
'path' => $imgPath
]);
return Redirect::back()->with(['msg' => 'successfully']);
}
}
namespace App\Http\Controllers;
use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
class HomeController extends Controller
{
public function uploadImage(Request $request)
{
$imgPath = Illustrator::setName('imageName')->upload($request->imageInput);
MyImage::create([
'path' => $imgPath
]);
return Redirect::back()->with(['msg' => 'successfully']);
}
}
namespace App\Http\Controllers;
use Amirsahra\Illustrator\Facade\Illustrator;
use App\MyImage;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
class HomeController extends Controller
{
public function uploadImage(Request $request)
{
$imgPath = Illustrator::setDisk('public')->upload($request->imageInput);
MyImage::create([
'path' => $imgPath
]);
return Redirect::back()->with(['msg' => 'successfully']);
}
}