Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9317957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T03:00:26+00:00 2026-06-19T03:00:26+00:00

I am using a php lightbox (this one – http://www.fatbellyman.com/webstuff/lightbox_gallery/index.php ) to automatically display

  • 0

I am using a php lightbox (this one – http://www.fatbellyman.com/webstuff/lightbox_gallery/index.php) to automatically display thumbnails and images. I would like to have the titles and image descriptions display on the larger lightbox images, pulled from a separate list (text file?). If it is possible to do this without using a database that would be best.

This is on my gallery page:

<?php include 'lightbox_display_function.php'; ?>
<?php lightbox_display('apparel/soiled/icarus/', 'lightbox[icarus]'); ?>

And this is the lightbox_display_function.php:

<?php function lightbox_display($dir_to_search, $rel){
        $image_dir = $dir_to_search;
        $dir_to_search = scandir($dir_to_search);
        $image_exts = array('gif', 'jpg', 'jpeg', 'png');
        $excluded_filename = '_t';
            foreach ($dir_to_search as $image_file){
            $dot = strrpos($image_file, '.');
            $filename = substr($image_file, 0, $dot);
            $filetype = substr($image_file, $dot+1);
            $thumbnail_file = strrpos($filename, $excluded_filename);
                if ((!$thumbnail_file) and array_search($filetype, $image_exts) !== false){
echo "<a href='".$image_dir.$image_file."' rel='".$rel."'>
<img src='".$image_dir.$filename."_t.".$filetype."' alt='".$filename."' width='70' height='70' title='$filename'/>
</a>"."\n";
                }
            }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-19T03:00:27+00:00Added an answer on June 19, 2026 at 3:00 am

    Do you have some sample code of how you have the page structured at the moment, off the top of my head could you not hard code them into an associative array of some sort?

    Have the image file name be the key, so that you can pair up titles with the necessary file?

    If you post what you have so far, we could have a look and hopefully make suggestions.

    — Update —

    Hardcore the array for the page before you call it, and include the array as a parameter so the elements in it can be paired up with the appropriate images in the function.

    <?php include 'lightbox_display_function.php'; ?>
    <?php
    $titleArray=array();
    $titleArray['RedCar.jpg']="Picture of red car";
    $titleArray['BlueCar.jpg']="Picture of blue car";
    $titleArray['GreenCar.jpg']="Picture of green car";
    lightbox_display('apparel/soiled/icarus/', 'lightbox[icarus]',$titleArray); 
    ?>
    

    So now in the function we have the information to work with

        <?php function lightbox_display($dir_to_search, $rel,$titleArray){
                $image_dir = $dir_to_search;
                $dir_to_search = scandir($dir_to_search);
                $image_exts = array('gif', 'jpg', 'jpeg', 'png');
                $excluded_filename = '_t';
                    foreach ($dir_to_search as $image_file){
                    $dot = strrpos($image_file, '.');
                    $filename = substr($image_file, 0, $dot);
                    $filetype = substr($image_file, $dot+1);
                    $thumbnail_file = strrpos($filename, $excluded_filename);
    
                    $title="";
                    if (array_key_exists($filename, $titleArray)) { //check if the filename matches a key in the array
                       $title = $titleArray[$filename]; //match, so set $title to equal the title set for that image name in the array
                    }
    
                    if ((!$thumbnail_file) and array_search($filetype, $image_exts) !== false){
                         //At this point $title can be included in the echo or used in some fashion, put is paired up with the appropriate image.
                         echo "<a href='".$image_dir.$image_file."' rel='".$rel."'>
                         <img src='".$image_dir.$filename."_t.".$filetype."' alt='".$filename."' width='70' height='70' title='$filename'/>
                         </a>"."\n";
                        }
                    }
            }
    

    I haven’t tested that but it should give you something to work with, theory if nothing else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am opening a an ajax window using prettyPhoto: http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/ This is my link
I am using this LightBox on http://sbc.mojopin.co.uk/portfolio.php and just cannot get it to work.
Using PHP I'm trying to download/save the following image: http://www.bobshop.nl/catalog/product_image.php?size=detail&id=42428 When you load this
I was working on this page: http://bigbassbrian.com/beta/photo.php I add the 2 following jQuery plugins:
Using PHP I have data feed fed in to an array: $index->indexDate this gives
I send form data using php in colorbox(lightbox) ifarme method. so i close auto
Using PHP I echo out table rows in a loop like this: <?php /*
i'd like to run a php-function dynamically by using this string: do_lightbox('image1.jpg', 'picture 1')
(CrossSlide) (LightBox) This is my header: <script type=text/javascript src=<?php echo ROOT.'sources/js/jquery.js'; ?>></script> <script type=text/javascript
Using php and mysql (and Drupal), I want to generate an index based on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.