I am trying to display an image with a caption and thumbnails. I am able to display the picture but I am finding difficult to display the image file name as caption.
Below is my code:
var slideIndex = 1;
showDivs[slideIndex];
function plusDivs[n] {
showDivs[slideIndex += n];
}
function showDivs[n] {
var i;
var x = document.getElementsByClassName["mySlides"];
if [n > x.length] {slideIndex = 1}
if [n < 1] {slideIndex = x.length}
for [i = 0; i < x.length; i++] {
x[i].style.display = "none";
}
x[slideIndex-1].style.display = "block";
}
halfer
19.6k17 gold badges92 silver badges175 bronze badges
asked Sep 30, 2016 at 10:43
To show caption set title attribute. And set name of image in tile attribute.
To get Image name from fullpath of Image use basename[$num]
Please replace your php code with below.
echo ''." ";
To get filename without extension for every image place below code in loop. And place $filename
variable where you want to display image name.
$filenamewithextension = basename[$num];
$fileextenstion = pathinfo[$filenamewithextension, PATHINFO_EXTENSION];
$filename = basename[$num,$fileextenstion];
$filename = trim[preg_replace['/[0-9]+/', '', $filename]];
answered Sep 30, 2016 at 10:49
Rahul PatelRahul Patel
5,1782 gold badges13 silver badges25 bronze badges
10
It’s very easy and simple. We need to Create Database for storing the user data. and write PHP script to get user data from the form and stored into database. We have provided all files and DB below of this blog. File name: index.php FIle Name upload.phpLet’s Create Database Using PhpMyadmin
phpmyadmin [Mysql] Dashboard
Table name with 4 columnsProper datatype and name of columnWrite PHP script, to upload image and get stored into DB
User Data form along with profile picture
Add User
Name :
Email :
Profile Picture: