0
<?php
$imageDir = "";
$images = glob($imageDir . '*.jpg');
foreach ($images as $image) {
?> 
<div class="col-lg-3 col-md-4 col-xs-6">
    <?php
    $name = chop($image, '.jpg');
    $filename = $image;
    if (file_exists($filename)) {
        $taken = "Screenshot Taken: " . date("F d Y H:i:s", filemtime($filename));
    }
    ?>
    <a data-gallery="example-gallery" style="text-decoration:none" href="<?php echo $image; ?>" class="d-block mb-4 h-100" data-toggle="lightbox" data-title="Player Name: <?php echo $name; ?>" data-footer="<?php echo $taken; ?>" data-max-width="800" >                            
        <img class="img-fluid img-thumbnail" src="<?php echo $image; ?>" alt="">
        <p><?php echo $name; ?></p>
    </a>
</div><?php}?>

Hi . i created a image gallery with php . using glob function. but some images wont display , because those images starts with a #(hash) . EX: www.mysite.com/ss/#insta.jpg iam using tags . is there any other way to view images like this in a

< img> tag

. enter image description here

  • Hmmm. does the image even display when you go to `www.mysite.com/ss/#insta.jpg`? The browser shouldn't even send a request for anything after the #. Are you sure the actual image is not accessible without #? – Miro Nov 25 '17 at 05:55
  • probably a bad idea to allow a # in the file name –  Nov 25 '17 at 05:58
  • icant view the image even from the browser. these images are screenshots of the players . some players starts their name with # or other symbols .. thts why i cant change the name of the image file . – James Heller Nov 25 '17 at 06:00
  • Possible duplicate of [How to escape hash character in URL](https://stackoverflow.com/questions/5007352/how-to-escape-hash-character-in-url) – Damiano Nov 25 '17 at 06:06

1 Answers1

4

Encode the # in your URL Replacing it with %23 should work

Damiano
  • 791
  • 1
  • 8
  • 22