so trying incorporate lightbox plugin in order have pop images: lightbox info
however php code code uses img tag rather a tag lightbox requires. seems href , src conflicts when try it. images , display correctly , matter of using lightbox code. wondering if of guys know how it.
<!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <script src="/var/www/html/jquery-1.11.3.min.js"></script> <script src="/var/www/lightbox2-master/dist/js/lightbox.js"></script> <title>greeting cards</title> <link rel="icon" type="image/png" href="../../favicon-32x32.png" sizes="32x32" /> <link rel="icon" type="image/png" href="../../favicon-16x16.png" sizes="16x16" /> <link rel="icon" type="image/x-icon" href="../../chromevers.ico" /> <link rel="stylesheet" type="text/css" href="../../styles/catbar.css"> <link rel="stylesheet" href="/var/www/lightbox2-master/dist/css/lightbox.css"> </head> <body> <?php include '/var/db_file.php'; include '/var/www/wideimage/lib/wideimage.php'; $con = mysqli_connect($thedb,$usr, $pass, "images"); mysqli_select_db($con, "images"); $query = "select * greeting_cards"; $result = mysqli_query($con, $query); $images = array(); while($row = mysqli_fetch_assoc($result)){ $images[] = $row['image']; } echo '<div id ="gallery">'; foreach ($images $image) { $image = wideimage::loadfromstring($image)->resize(300, 300); echo '<img id="database" src="data:image/jpeg;base64,'. base64_encode($image) .'" />'; } echo '</div>'; mysqli_close($con); ?> </body> </html> thank you!
i managed display images way. uploaded images server , stored image path on database. way make website faster since wouldn't pulling blob lots of images , reference them on server. here line of code:
echo '<a href="'. $image.'" data-lightbox="roadtrip"><img id="dbimages" src="data:image/jpg;base64,'.base64_encode($reimage).'"/></a>';
the $image variable $row = mysqli_fetch_assoc() call storing image path. , $reimage using php library wideimage load image path. library has lots of other useful image manipulation functions can use. hope helped!
Comments
Post a Comment