xxxxxxxxxx
<img src="{{asset($item->image)}}" width="100" height="100">
xxxxxxxxxx
<img src="{{ asset($item->image) }}">
or
<img src="{{ asset('/public/upload/image.jpg') }}">
xxxxxxxxxx
<img src="{{ url('') }}/public/images/{{$result->image }}">
or
<img src="{{url('/public/images/')}}/{{$result->image }}">
xxxxxxxxxx
<img src="{{ url('') }}/public/images/post_images/{{$result->post_img }}">
or
<img src="{{url('/public/images/post_images/')}}/{{$result->post_img }}">
https://image.intervention.io/v2/introduction/installation
xxxxxxxxxx
// import the Intervention Image Manager Class
use Intervention\Image\ImageManager;
// create an image manager instance with favored driver
$manager = new ImageManager(['driver' => 'imagick']);
// to finally create image instances
$image = $manager->make('public/foo.jpg')->resize(300, 200);
//documentation: https://image.intervention.io/v2/introduction/installation
xxxxxxxxxx
$fileName = $file->storePublicly('images/media', [
'disk' => 's3'
]);
#image
xxxxxxxxxx
<?php
namespace App\Traits;
use Illuminate\Support\Str;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
trait Upload
{
public function UploadFile(UploadedFile $file, $folder = null, $disk = 'public', $filename = null)
{
$FileName = !is_null($filename) ? $filename : Str::random(10);
return $file->storeAs(
$folder,
$FileName . "." . $file->getClientOriginalExtension(),
$disk
);
}
public function deleteFile($path, $disk = 'public')
{
Storage::disk($disk)->delete($path);
}
}