How to hide an image URL in laravel? so if you wish to hide the image URL from the image tage in the browser inspection, I will tell you how to remove the image URL, and instead of the image url, we will add base64 encode code for the show image in the laravel application.
Sometimes clients do not want to show the image URL from where to coming or want to hide the image file source URL form the URL or publically, that time this post will help you.
I have below made a code example that code will replace the image URL with base64 code and will show the image using this base64 code. so that our image URL will hide and not be able to see publically.
$path = Storage::disk('public')->url('profile/profile-image.jpg');
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
$base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
<img src="{{ $base64 }}" alt="image">
We always thanks to you for reading our blogs.
Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- Laravel 10 Forum Integration Tutorial Example
- Laravel 9 CRUD Operation From Scratch Step By Step Guideline
- Import Export Database in JSON Format Laravel
- PhonePe Payment Gateway Integration in Laravel
- Laravel 10 Firebase Web Push Notification Tutorial
- How To Change The Views Or Blade File Path In Laravel
- Laravel-9 Multi Authentication Guard Passport API Example
- Know All About Laravel Mixin Use In Vue Js With Example
- Error : The MAC is invalid Question's And Solutions [Solved]
- Laravel Email Send