Changeset 285 for branches/1.1dev/lib


Ignore:
Timestamp:
Oct 21, 2007 12:01:16 AM (17 years ago)
Author:
quinn
Message:

Added original_index to array returned by Upload::process(), and added Upload::getFilenameGlob().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.1dev/lib/Upload.inc.php

    r203 r285  
    426426                $new_file_names[] = array(
    427427                    'name' => $file_name,
     428                    'mime' => $files['type'][$i],
    428429                    'size' => filesize($file_path_name),
    429                     'extension' => strtolower(substr($file_name, strrpos($file_name, '.') + 1)),
     430                    'extension' => $this->getFilenameExtension($file_name),
     431                    'original_index' => $i,
    430432                );
    431433                continue;
     
    511513       
    512514        return file_exists($this->upload_directory_path . '/' . $file_name);
     515    }
     516
     517    /**
     518     * Get filename by glob pattern. Searches a directory for an image that matches the
     519     * specified glob pattern and returns the filename of the first file found.
     520     *
     521     * @access  public
     522     * @param   string  $pattern   Pattern to match filename.
     523     * @return  string filename on success, empty string on failure.
     524     * @author  Quinn Comendant <quinn@strangecode.com>
     525     * @since   15 Nov 2005 20:55:22
     526     */
     527    function getFilenameGlob($pattern)
     528    {
     529        $file_list = glob(sprintf('%s/%s', $this->upload_directory_path, $pattern));
     530        if (isset($file_list[0])) {
     531            return basename($file_list[0]);
     532        } else {
     533            return '';
     534        }
    513535    }
    514536
Note: See TracChangeset for help on using the changeset viewer.