Jump to content

Recommended Posts

preload? do you mean by preview or something? if that is true, i think it involves more than php, because php only handles the online directories, it might work if you save them in the tmp folder or something, but this involves refreshing the page, so i doubt if this is what you want, but afterall, i am not sure...
Ted
Link to comment
https://forums.phpfreaks.com/topic/34250-preload-images/#findComment-161107
Share on other sites

as in...retrieving a list from a directory?

[code]
<?php
  $path = "path/to/images/";
 
  // if the directory exists...
  if ( $img_dir = @opendir($path) ) {
      // while there are files to read in the dir listing...
      while ( false !== ($img_file = readdir($img_dir)) ) {
        // if the mime type is .jpg (add checks for other image file types here, if you like) ...
        if ( preg_match("/(\.jpg)$/", $img_file) ) {
            // add it to list of images available
            $images[] = $img_file;
        } // end if image found
      } // end while files in dir list
  // close the dir stream
  closedir($img_dir);
  } // end if dir opened

  // if there are images to display...
  if ($images) {
      // for each image...
      foreach ($images as $img) {
        // echo image
echo "<img src = '$path$img' />";
      } // end foreach image
  } // end if images
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34250-preload-images/#findComment-161169
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.