jch02140 Posted September 13, 2010 Share Posted September 13, 2010 Hi, I am planning to display remote images with the following code but it seems to return errors. <?php $image_dir = 'http://www.domain.com/images/' ; $dir_handle = opendir( $image_dir ); $count = 0 ; $display = '' ; while( $filename = readdir($dir_handle)){ if( preg_match( '/$[a-z0-9]{4}_th\.jpg$/' , $filename ) ){ $display .= " <img src='$image_dir$filename' /> " ; $count++ ; if( $count % 10 == 0 ){ $count=0; $display .= "<br />"; } } } closedir( $dir_handle ); echo $display ; ?> I am thinking might be the $image_dir cannot use address format.... Errors is as follow Warning: opendir(http://www.foo.com/images/) [function.opendir]: failed to open dir: not implemented in /home/jch02140/public_html/test.php on line 3 Warning: readdir(): supplied argument is not a valid Directory resource in /home/jch02140/public_html/test.php on line 6 Warning: closedir(): supplied argument is not a valid Directory resource in /home/jch02140/public_html/test.php on line 16 Quote Link to comment Share on other sites More sharing options...
chintansshah Posted September 13, 2010 Share Posted September 13, 2010 opendir is not work for http, it works with ftp only. You should find any alternative solution. 1. CURL 2. Fsocket Please let me know if you are not aware of about two terms. Quote Link to comment Share on other sites More sharing options...
jch02140 Posted September 14, 2010 Author Share Posted September 14, 2010 I am not sure about CURL... but I read a little on foscket.. but I am not sure how to implement it... Quote Link to comment 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.