<!--KARUSEL-->
.$karusel_HTML = file_get_contents("./karusel.html");
$html = str_replace("<!--KARUSEL-->", $karusel_HTML, $html);
<a href="#"/>
там, где должен быть <button/>
, вы уже сделали половину семантики страницы. -window.addEventListener('DOMContentLoaded', () => {
+document.addEventListener('DOMContentLoaded', () => {
Стоит ли хранить изображения base64 в БД?
composer require symfony/dom-crawler
use Symfony\Component\DomCrawler\Crawler;
use Illuminate\Support\Facades\Storage;
use Illuminate\Http\File;
$desc = $request->input('some_html'); // POST with html
$dom_desc = new Crawler($desc);
$images = $dom_desc->filterXPath('//img')->extract(array('src')); // extract images
foreach ($images as $key => $value) {
if (strpos($value, 'base64') !== false) { // leave alone not base64 images
$data = explode(',', $value); // split image mime and body
$tmp_file = tempnam('/tmp', 'items'); // create tmp file path
file_put_contents($tmp_file, base64_decode($data[1])); // fill temp file with image
$path = Storage::putFile('public/items', new File($tmp_file)); // put file to final destination
$desc = str_replace($value, $path, $desc); // replace src of converted file to fs path
unlink($tmp_file); // delete temp file
}
}
Могу предположить что что-то на подобии gsap
<label><input type="radio"><span>1</span></label>
label > input {
position: absolute;
width: 0;
height: 0;
overflow: hidden;
}
label > span {
display: flex;
align-items: center;
}
label > span::before {
content: '';
width: 2em;
height: 2em;
border-radius: 50%;
border: 2px solid #888;
background: content-box #FFF0;
padding: 2px;
}
label > input:checked + span {
background-color: #00F;
border-color: #00F;
}