Reputation: 350
I want to display metaimage when i share my link. But i am unable to get image. here is my code. please suggest me what is in my code. Iam new laravel.
<meta property="og:image" content="../storage/uploads/{{$page->meta_image}}">
Upvotes: 3
Views: 22001
Reputation: 1469
You can use ENV('APP_URL', 'http://localhost')
from .env
file
Upvotes: 0
Reputation: 1671
For you use storage path :
// (assuming you using storage location)
$path = storage_path();
$path = storage_path($page->meta_image);
<meta property="og:image" content="{{$path}}">
To Get the base Path:
$path = base_path();
To Get Public Path :
$path = public_path();
$path = public_path('css/app.css');
To Get Site URL Path :
$path = url("your_image_path"); // http://example.com/...
Reference : Laravel Path Helper
Upvotes: 3
Reputation: 3274
<meta property="og:image" content="{{ url('/path_to_image') }}">
Ref. : https://laravel.com/docs/5.7/helpers
Upvotes: 8