I'd like to add photos to my cck field in gereksizseyler.com where adding photos are critical and one node have about 3 photos. It got hard to find lastest uploaded photo. so I hacked inc/page.inc.
I got the directory list with file modification dates as an array. Then sort and let the remaining code process further as usual with foreach. While loop prevents duplicate date of files which is possible mostly with shell commands. Because the keys are used by sort function the real values are not needed.

FileMTime function can be replaced by filesize to get the list ordered by sizes (In fact i wrote that so at first, then remembered what I supposed to do :D )
starting from line867

  $exclude = array('.' => 1, '..' => 1, 'CVS' => 1, '.svn' => 1, '.htaccess' => 1);
  $files =Array();
  while (($file = readdir($handle)) !== FALSE) {
    $filetime = filemtime($dirpath .'/'.$file);
    while(array_key_exists($filetime, $files)){
	$filetime++;
    }
    $files[$filetime]  = $file;
  }
  krsort($files);
  foreach($files as $file){
  //while (($file = readdir($handle)) !== FALSE) {

Comments

nerkn’s picture

Status: Active » Closed (fixed)

headers of the filebrowser has clickablility, and the sort is done throught js.