I am trying to identify what media type on my blade template, so I can choose what template should use video or images.
I don't have idea how to check it behind the scene, but I know there was mime_content_type
on PHP so i decide to use that on my blade.
here my template.blade.php
@if(!empty($post->media))
@php
$media = mime_content_type(url('/').$post->media);
@endphp
@if(strstr($media, "video/"))
....
action here
....
@elseif(strstr($media, "image/"))
....
action here
....
@endif
@endif
but when I visit the page. its return an error.
ErrorException (E_ERROR) mime_content_type(http://127.0.0.1:8000/storage/2175b1bbdf7893cbf4145f386e434b50.mp4): failed to open stream: HTTP request failed!
but when I visit directly to http://127.0.0.1:8000/storage/2175b1bbdf7893cbf4145f386e434b50.mp4
via my browser, the videos are coming up.
its seem fail on this step
$media = mime_content_type(url('/').$post->media);
what my mistake here?... any suggestion?... thank you!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire