Skip to content

Commit

Permalink
add image preview in view
Browse files Browse the repository at this point in the history
  • Loading branch information
reziamini committed Mar 19, 2021
1 parent 0130de2 commit 13e0b26
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Parsers/HTMLInputs/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

namespace EasyPanel\Parsers\HTMLInputs;

use Illuminate\Support\Str;

class File
{

public function handle($name)
{
return "<input type='file' wire:model='$name' class=\"form-control-file @error('$name') is-invalid @enderror\" id='input$name'>";
$string = '$'.$name;
return "<input type='file' wire:model='$name' class=\"form-control-file @error('$name') is-invalid @enderror\" id='input$name'>
@if($string and !".'$errors'."->has('$name') and $string instanceof \Livewire\TemporaryUploadedFile and (in_array( ".$string."->guessExtension(), ['png', 'jpg', 'gif', 'jpeg'])))
<a href=\"{{ ".$string."->temporaryUrl() }}\"><img width=\"200\" height=\"200\" class=\"img-fluid shadow\" src=\"{{ ".$string."->temporaryUrl() }}\" alt=\"\"></a>
@endif";
}
}

0 comments on commit 13e0b26

Please sign in to comment.