@davy_yg you can use image method to download the file and save it to your public/avatar directory:
$faker->image('public/avatar', 640, 480, null, false);
https://github.com/fzaninotto/Faker/blob/master/src/Faker/Provider/Image.php#L58
Hello,
I create this avatar upload file. There is one problem I need to be able to create the avatar through faker generator avatar which I already able to create one as well as editing the avatar by uploading my own avatar.
<tr>
<td>Group Name</td>
<td>
<select class="custom-select d-block w-100" name="group_id" required>
<option value="0">Select</option>
@foreach($glist as $item)
<option value="{{ $item->id }}" @if($list->group_id == $item->id) selected @endif>{{ $item->group_name }}</option>
@endforeach
</select>
</td>
</tr>
<tr>
<td>Avatar </td>
<!-- <td><img src="{{ url(Storage::url($list->avatar)) }}" width="50%" height="50%"></td> -->
<td><img src="{{ ($list->avatar) }}" width="25%" height="25%"></td>
</tr>
<tr>
<td></td>
<td><div style="color: #a09e9e;"><b>200px x 200px</b></div></td>
</tr>
<tr>
<td>Upload</td>
<td>
<input type="file" name="avatar" id="avatar">
</td>
</tr>
This is the url through faker generator: https://www.gravatar.com/avatar/75963?d=retro&size=80
This is the url if I upload my own avatar: public/avatar/l0HuuCUKOnbf5tg0c4DJypCZicb43MaUO07DGejl.jpeg
I am confuse how should I show the uploaded image:
This only works if I uploaded my own avatar:
<td><img src="{{ url(Storage::url($list->avatar)) }}" width="50%" height="50%"></td>
and this only works to show my generated avatar with the faker:
<td><img src="{{ ($list->avatar) }}" width="25%" height="25%"></td>
I would like to make both avatar works, how?
Please or to participate in this conversation.