I want to upload an embedded youtube video in my laravel website.
For that I have uploaded an embedded youtube video link (provides from youtube embed option) in my admin panel and saved to database. Then I retrieved the video links from database and try to show it in blade template. But frontend only shows the video link as it saved in the database not the video.
<iframe width="300" height="220" src="https://www.youtube.com/embed/6T8stXj7Dzg?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
But if I manually used the links in the html then the video successfully shown.Like below code
<div id="panel-9-11-0-0" class="so-panel widget widget_sow-editor panel-first-child" data-index="27" >
<iframe width="300" height="220" src="https://www.youtube.com/embed/E7SCzULQYUQ?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<h3>title</h3>
</div>
How can I solve it ?
Follow the link to setup laravel project for uploading an embedded video in laravel
https://packagist.org/packages/cohensive/embed
blade part
#foreach($video as $data)
<div class="media">
<h4>{{ $data->title }}</h4>
<div class="media-body">
{!! Embed::make($data->links)->parseUrl()->getIframe() !!}
</div>
</div>
#endforeach
Related
I´m trying to add img into Blade email in Laravel. But when I receive my email, I can´t see my image, but URL is correct. I´m trying to add img this way:
<img src="{{ asset('/public/images/guiapaladar-qrcode.png') }}" alt="" style="width: 20%;">
In Google Console I can see this:
<img src="https://ci5.googleusercontent.com/proxy/-Ay7pcevYLhUaAu4iicFdd-kGPKGB9hXRemwYYmoes8GnA4nN6Qe_FZDKenf_iDgiNpx5Xb1QX7p_2Su5DCOHAb2-UI8gGHkJhK9V6qb4R-B6_QY=s0-d-e1-ft#http://127.0.0.1/guiaPaladar/public/images/guiapaladar-qrcode.png" alt="" style="width:20%" class="CToWUd">
but in my email it doesn't show my image.
Thanks for help me
If you are sending email through localhost then image will not be displayed. But if you are sending it live then use the following code:
<img src="{{asset('images/guiapaladar-qrcode.png')}}" alt="" style="width: 20%;">
With using markdown you can just :
![Random text][logo]
[logo]: {{asset('/images/image.png')}} "Logo"
Or simply :
<img src="data:image/png;base64,{{base64_encode(file_get_contents(resource_path('images/image.png')))}}" alt="">
There is a route problem or image address problem. The image is not displaying on some pages but displaying on some pages:
This is the route address in which image is not displaying:
Route::get('users/edit/{id}', [App\Http\Controllers\UserController::class, 'edit'])->name('edit-user');
and this is the image address of this route:
http://localhost/Complain-Management-System/public/users/edit/images/1312455072.jpg
and this is the image source on blade:
<img src="images/{{ Auth::user()->image }}" class="rounded-circle" width="130" height="130" alt="">
The image is displaying good on this route:
Route::get('users', [App\Http\Controllers\UserController::class, 'index'])->name('manage-user');
and the image URL of this route is:
http://localhost/Complain-Management-System/public/images/1312455072.jpg
Can someone please solve this problem, it's important. Thanks
This was the src problem then i try to add the full address like:
<img src="/Complain-Management-System/public/images/{{ Auth::user()->image }}" class="rounded-circle" width="130" height="130" alt="">
and it works!
<iframe width="853" height="480"
src="<?php echo 'https://www.youtube.com/embed/oLuKopMbl9k'; ?>"
frameborder="0"
allow="accelerometer;
autoplay;
encrypted-media;
gyroscope;
picture-in-picture" allowfullscreen>
</iframe>
How can I hide actual YouTube video URL in codeingiter / PHP from user,
I have hide the "src" attribute value so user no one can directly copy and paste it.
As far as i know, its not possible to hide a URL from user, user will always be able to download the video as long he can watch it in browser
EDIT: forget to mention you can try to use other platforms, but with you tube is not possible to hide as you can click on the logo and open in YouTube
I'm trying to accomplish something like this website
http://ilpvideo.com
As you can see any video that you click on,
takes you to that same page. The only difference is the video playing.
I'm trying to do the same for my website. here is my code
//index.php
<div class="thumbnail">
<a href="video.php?id=video1">
<img src="/local/images/vid_01.jpg">
</a>
</div>
<div class="thumbnail">
<a href="video.php?id=video2">
<img src="/images/vid_02.jpg">
</a>
</div>
<div class="thumbnail">
<a href="video.php?id=video3">
<img src="/images/vid_03.jpg">
</a>
</div>
This part here I can't quite understand yet.
When a video is clicked on index.php
I should send the user to video.php
and inside that iframe element it should only send the video id.
ex:
video1 is click then iframe should be src="media/video1.mp4"
video2 is click then iframe should be src="media/video2.mp4"
video3 is click then iframe should be src="media/video3.mp4"
//video.php
$id = $_GET['id'];
<section id="video-php">
<iframe src="media/<?php echo $id?>.mp4" allowfullscreen></iframe>
</section>
Updated my question.
I have another question.
How can make it so that when a unique video ID
is click, to also included the video title. Is there such tag in php
to make this happen?
You forgot the "echo" before your variable $id. I think that's why it didn't work.
You should use the video tag provided by HTML5. It allows you to insert a video content into your web page.
<?php
$id = $_GET['id'];
?>
<video width="320" height="240" controls>
<source src="media/<?php echo $id; ?>.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
I am including a Youtube video in my webpage, this is the code:
<div id="content">
<iframe class="aftermovie" width="800" height="450" src="//www.youtube.com/
embed/vjFA_UNSl9c?rel=0" frameborder="0" allowfullscreen>
</iframe>
</div>
The site is running in localhost, when I use Chrome to see the page I see the video but can't do anything, in Firefox everything runs like it is supposed to.
you need the http protocole in your src to make this work with chrome
<iframe class="aftermovie" width="800" height="450" src="http://www.youtube.com/embed/B4bb69Moff8?rel=0" frameborder="0" allowfullscreen></iframe>