Enabled short_open_tag in php.ini and now its working
Im trying to run simple blazy script locally with XAMPP And I'm getting error that
Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\gallery.php on line 61
It works perfectly fine on Mac with command php -S 127.0.0.1:8000
And I can't see any issue with the code, am I missing something? Here is my code:
<!DOCTYPE html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blazy/1.8.2/blazy.min.js"></script>
<script src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.js"></script>
<link rel="stylesheet" href="style.css">
<title>blazy test</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
.b-lazy {
/**transform: scale(1);
transition: all 500ms;
opacity:0;**/
}
.b-loaded {
transform: scale(1);
opacity:1;
width: 500px;
height: 350px;
}
</style>
</head>
<body>
<?php
// set folder path
$path = "images/";
// count no. of images in dir
$cnt = count(glob($path . "*.{jpg,jpeg}", GLOB_BRACE));
if ($cnt > 0) {
$fp = opendir($path);
while ($image = readdir($fp)) {
$ext = pathinfo($image, PATHINFO_EXTENSION);
$allowed_ext = ['jpg', 'jpeg'];
if (in_array($ext, $allowed_ext)) {
$image_path = $path . $image; ?>
<div class="wrapper">
<img
class="b-lazy image-wrapper"
src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
data-src="<?php echo $image_path; ?>"
alt="<?php echo $image; ?>" />
</div>
<? }
}
closedir($fp);
} else {
echo "Sorry! No images available in gallery!";
}
?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/blazy/1.8.2/blazy.min.js" type="text/javascript"></script>
<script type="text/javascript">
;(function() {
var bLazy = new Blazy();
})();
</script>
</body>
</html>