open-admin
open-admin copied to clipboard
Image field URL prefix duplicate
I installed open-admin by following the instructions step by step, Then I updated the config/filesystems.php and added the following :
'admin' => [
'driver' => 'local',
'root' => public_path('uploads'),
'visibility' => 'public',
'url' => env('APP_URL').'/uploads',
],
I update user record from admin http://localhost/admin/auth/users/1/edit
and upload new avatar image
The Image is not showing, when I inspect the image I found that image url prefix duplicated as following
http://localhost/uploads/http://localhost/uploads/images/User_icon-cp.png
How to resolve that issue?
I have this same problem, have you found any solution for this?
Same problem here, also need a solution to this. Showing when inspecting: http://localhost/uploads/http://localhost/uploads/images/image.png
In admin.php file: 'upload' => [
// Disk in `config/filesystem.php`.
'disk' => 'admin',
// Image and file upload path under the disk above.
'directory' => [
'image' => 'images',
'file' => 'files',
],
],
In filesystems.php file: 'disks' => [
'admin' => [
'driver' => 'local',
'root' => public_path('uploads'),
'url' => env('APP_URL').'/uploads',
'visibility' => 'public',
],
...
..
I have this same problem, have you found any solution for this?
anyone?
The problem occurs because the images path are saved with full path in the database.
I solved this problem changing the 'upload' default disk to 'public' in config/admin.php
file:
'upload' => [
// Disk in config/filesystem.php.
'disk' => 'public',
// Image and file upload path under the disk above.
'directory' => [
'image' => 'images',
'file' => 'files',
],
],
In config/filesystem.php
I setted the public
path this way:
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'url' => env('APP_URL').'/storage', // set url
'visibility' => 'public',
'throw' => false,
],
This way the path is relative. This configuration worked for both localhost and live servers.
I implement this way in my Blade templates.
<img src="{{ asset('storage') . '/' . $image }}">