Anyone able to throw together a html search

Discussion in 'HTML & Website Design' started by jazzzyman, Mar 12, 2013.

  1. #1
    would anyone be able to make a site search in html that pulls keywords from image filenames or alts and displays thumbnails on a results page?
     
    jazzzyman, Mar 12, 2013 IP
  2. jazzzyman

    jazzzyman Well-Known Member

    Messages:
    117
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #2
    also forgot to add that my images are in different folders and not databases etc
     
    jazzzyman, Mar 12, 2013 IP
  3. scottlpool2003

    scottlpool2003 Well-Known Member

    Messages:
    1,708
    Likes Received:
    49
    Best Answers:
    9
    Trophy Points:
    150
    #3
    I'm not too sure you've thought this through properly. It'll be quite hard to do exactly what you want without having the data stored in the database, but this may get you started:

    <?php
    $dir    = '/images';
    $files1 = scandir($dir);
    $files2 = scandir($dir, 1);
     
    print_r($files1);
    print_r($files2);
    ?>
    PHP:
    http://php.net/manual/en/function.scandir.php

    This will scan $dir and put all file names into an array. It's up to you how you handle the array but with it you have both the image name and the image location allowing you to show the image as an image and the image name as text. You could strip out the .* extension so you have the pure text version.

    As for image alt tags, well they aren't stored in a directory, they're stored on a page.
     
    scottlpool2003, Mar 12, 2013 IP