Upload Data in Laravel Using SummerNote Editor with Image
HTML-код
- Опубликовано: 31 май 2023
- #summernotelaravel
Support This Channel :
Join this channel to get access to perks:
/ @webtechknowledge
Your support will be really appreciated.
Thanks For Watching.
I hope This video was helpful. If you have any questions then let me know in the comment section.
Best of luck
#webtechknowledge
You can connect with me with the given links below:
Facebook Link: / yaminshakil07
Instagram Link: / yamin_shakil
Twitter Link: / yaheashakil
The Code :
$dom = new \DomDocument();
$dom->loadHtml($description, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
$imageFile = $dom->getElementsByTagName('imageFile');
foreach($imageFile as $item => $image)
{
$data = $img->getAttribute('src');
list($type, $data) = explode(';', $data);
list(, $data) = explode(',', $data);
$imgeData = base64_decode($data);
$image_name= "/upload/" . time().$item.'.png';
$path = public_path() . $image_name;
file_put_contents($path, $imgeData);
$image->removeAttribute('src');
$image->setAttribute('src', $image_name);
}
$description = $dom->saveHTML();
Love the video. Thank you very much!!
It's was amazing
very educational as always
Glad you enjoyed it
Thank you
Thanks!! but unicode (Bangla) text not shown correctly. It shows in database like 'à¦'.
DomDocument::loadhtml function cannot be safely used for sanitizing HTML 5.
You've not twitter on your Twitter page...
please please make one complete real life project which probably contain more laravel concepts. please please please. I want enroll for your courses but no payment options from my country. please please
same
How to update image?