Jump to content

Simple remote image display script help


jch02140

Recommended Posts

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

Link to comment
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.