(09-23-2021, 04:45 AM)wdeda Wrote: Since it is a background image it should be contained in an external CSS file, it is not recommended to use CSS files inline:
Code:
.max-header {
box-shadow: rgba(0, 0, 0, 0.35) 0px 2px 5px;
position: relative;
height: 97px;
border-top: 1px solid rgb(40, 40, 40);
border-bottom: 1px solid rgb(40, 40, 40);
background-color: rgb(27, 27, 27);
background-image: url('/assets/img/common/header_wd-gradient.png');
background-repeat: repeat-x;
z-index: 51;
}
usually what is stored in a database is the file identification, file name, almost always for use in a variable:
<img width="960" src="/assets/img/home/banners/<?= $data1->link ?>.jpg" height="418">
unless the path stored in the DB contains the file format, jpg, png, etc., this is not informed in the given example;
and there is a closing bracket without the corresponding opening bracket and even if it were there it would cause a coding error.
style="
background-image: url('<?= base_url('image_path']); ?>');">
Sorry but I had made a mistake when posting the code here and have edited it. Also, the path in the database is stored like;
The thing is there is an admin side where he/she (the admin) can add image(s) which then appears on the site. I then query and display the image on the slider. I was thinking of doing it like this in my PHP file but possibly as a last resort:
PHP Code:
<style {csp-style-nonce}>
.single-slider {
background-image: url('<?= base_url($sliderimages['image_path']); ?>');
}
</style>