We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15871
    • 105 Posts
    Anyone know how to modify the scrip to ignore invisible files? The script keeps grabbing the thumbnails that the system creates for the file manager.

    Hey, I figured it out, just change the While statement:


    
    	while ( $file = readdir( $imgDir ) )
    	{	
    		//checks that file is an image
    		$file_type = strrchr( $file, "." );
    		$is_image = eregi( "jpg|gif",$file_type );
                    $is_hidden = substr($file,0,1); // This grabs if the first character of the filename.
    
    		if ( $file != '.' && $file != '..' && $is_image && $is_hidden != '.' ) // Added the is_hidden variable to the conditional statement to not include any files that starts with a period (".").
    		{ $images[$i++] = $file; }
    	}
    
    

      • 3349
      • 126 Posts
      Hope someone can help. I’d like to modify the script to have the snippet show say 5 random images. But these cant be the same image (all different) I’ve tried calling the snippet 5 times but it shows the same pic 5 times.

      It would also be good if there was a parameter to set the amount of images to show meaning the snuppet only needs called once.

      Can anyone help?

      Thanks

      bS