OmarHaydoor Posted January 15, 2007 Share Posted January 15, 2007 How can I preload images in phpThanks.. Quote Link to comment https://forums.phpfreaks.com/topic/34250-preload-images/ Share on other sites More sharing options...
ted_chou12 Posted January 15, 2007 Share Posted January 15, 2007 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 Quote Link to comment https://forums.phpfreaks.com/topic/34250-preload-images/#findComment-161107 Share on other sites More sharing options...
.josh Posted January 15, 2007 Share Posted January 15, 2007 You don't. preloading something is a client-side thing. Quote Link to comment https://forums.phpfreaks.com/topic/34250-preload-images/#findComment-161118 Share on other sites More sharing options...
OmarHaydoor Posted January 15, 2007 Author Share Posted January 15, 2007 I mean loading the images then showing them Quote Link to comment https://forums.phpfreaks.com/topic/34250-preload-images/#findComment-161121 Share on other sites More sharing options...
.josh Posted January 15, 2007 Share Posted January 15, 2007 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] Quote Link to comment https://forums.phpfreaks.com/topic/34250-preload-images/#findComment-161169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.