Current location: Hot Scripts Forums » General Community » Script Requests » Script to view and delete images in a directory


Script to view and delete images in a directory

Reply
  #11 (permalink)  
Old 10-08-09, 10:33 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
PHP Code:

<?php

$path  
'./'// change the path here related to this page
$files glob("{$path}*.*"); // Get the files
$files array_filter($files'is_file'); // Get rid of directories
$dates array_map('filectime'$files); // Get the creation times.
$md5s  = array();

array_multisort($dates$filesSORT_NUMERIC); // Sort files in order of creation.

foreach ($files AS $file)
{
    
$hash md5_file($file);
    
    if (!
in_array($hash$md5s))
    {    
        
$md5s[] = $hash;

        echo 
"<img src=\"$file\" /> <br />
        <form action=\"delete.php\" method=\"post\">
           <input type=\"hidden\" name=\"Name\" value=\"
$file\">  
           <input type=\"submit\" value=\"Delete\">
        </form>"
;
    }

}

?>
They're now ordered by their time of creation. I haven't completely tested it, but it should ignore duplicates as well.

PHP: glob - Manual
PHP: filectime - Manual
PHP: array_multisort - Manual
PHP: array_filter - Manual
PHP: array_map - Manual
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #12 (permalink)  
Old 10-09-09, 10:23 AM
sac0o01 sac0o01 is offline
Newbie Coder
 
Join Date: Jul 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Thank you so much Nico! It works great.

Perhaps this would be a good script to list here at Hotscripts. In my search for a script like this I noticed I am not the only one out there looking for this function.

Also I checked out out your Rotator script. I run a script like this on my site but it is not nearly as nice. Is this script available for purchase? or at least may I run it on an iframe on my site?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #13 (permalink)  
Old 10-09-09, 04:56 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
You're welcome, I'm glad it works.

And there are a few problems with my site after I changed hosts, but I might be willing to fix them and sell the site. Any takers?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #14 (permalink)  
Old 10-09-09, 05:29 PM
ruteckycs's Avatar
ruteckycs ruteckycs is offline
Coding Addict
 
Join Date: Jul 2009
Posts: 377
Thanks: 6
Thanked 10 Times in 10 Posts
Whats the site URL?
__________________
This post was created with 100% recycled electrons.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #15 (permalink)  
Old 10-09-09, 05:44 PM
sac0o01 sac0o01 is offline
Newbie Coder
 
Join Date: Jul 2009
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Not really looking for another site unless it was a really good price, but if you get the script fixed I would be interested in the script.

I set up a rotation but it doesn't display the images.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Free Image Hosting / Script Sale 4n7hr4x Job Offers & Assistance 9 10-29-04 09:13 PM
View, edit, delete and add data to a database bigkid PHP 9 07-22-04 12:51 AM
Need Epinions-lite system in PHP & MYSQL wali001 Job Offers & Assistance 4 01-12-04 07:02 AM


All times are GMT -5. The time now is 01:46 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.