Current location: Hot Scripts Forums » Programming Languages » PHP » Scan dir, seperate file by name convension...

Scan dir, seperate file by name convension...

Reply
  #1  
Old 06-09-09, 12:33 PM
peuplarchie's Avatar
peuplarchie peuplarchie is offline
Newbie Coder
 
Join Date: Nov 2008
Posts: 63
Thanks: 1
Thanked 0 Times in 0 Posts
Post Scan dir, seperate file by name convension...

Good day to you all,
here I have a script that show all images in a directory.

My questions :
1. How can I make my scan dir for each folder listed in the specified folder, only 1 level.
2. My naming convension is adding a "_1" at the end of the portrait images, "_0" to the landscape and "_2" to the end of a panoramic image.

How can I seperate the result ?

So basicly :

ACDC
Portrait images
Landscape images
Panoramic images

Aerosmith
Portrait images
Landscape images
Panoramic images

Here is my code right now :

PHP Code:



<?php

         set_time_limit
(0);
        
        
        
$dir $_GET['dir'];
$directory $dir;

$diri $directory//You could add a $_GET to change the directory
$files scandir($diri);
echo 
"<div id=\"bar\"><b>".$directory."</b></div><br/>";
echo 
"<div>";
foreach(
$files as $key => $value){
    
    if (
$value != "." && $value != "..") {

    echo 
"<a onmouseover=this.style.cursor=\"pointer\" ' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'block' \" ><img src=\"".$directory."/".$value."\" width=\"50px\" class=\"imag\"></a>\n"
    echo 
"<div id='".$value."' style='display: none;  position: absolute;  text-align:left; margin: 0px -300px; margin-top:-150px;  z-index:50; border: solid black 1px; padding: 10px; background-color: #ffffff; text-align: justify; font-size: 12px; onmouseover='this.style.cursor=\"pointer\" ' style='font-size: 12px;' onfocus='this.blur();' onclick=\"document.getElementById('".$value."').style.display = 'none' \" >";
    echo 
"<img src=\"".$directory."/".$value."\" /><br />".$value."<br/></div>";
    
    
    }else{
        
        echo 
"";
        
        }
    
}
echo 
"</div>"

 
?>
Thanks !
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hello all, can you help me? K4ot1K Other Languages 2 01-23-09 06:23 AM
Rename/Copy File to new dir samot PHP 2 04-24-07 04:38 PM
Error message not getting displayed. sanjeet Windows .NET Programming 0 12-20-05 11:48 AM
Dir showing as file jack_mcs PHP 4 10-11-04 07:48 PM
Upload file to table so ONLY files tied to primary key are displayed in record? grafixDummy PHP 4 12-20-03 05:28 PM


All times are GMT -5. The time now is 07:35 PM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2 (Unregistered)