function __construct(&$parent, $base_folder, $picked_filepath = NULL) { parent::__construct($parent, '選取影像檔案...', $base_folder, wxEmptyString, 'JPEG 檔案 (*.jpg)|*.jpg|JPEG 檔案 (*.jpeg)|*.jpg|PNG 檔案 (*.png)|*.png'); $this->base_folder = $base_folder; if (empty($picked_filepath)) { foreach (array('photo', 'pic') as $folder) { $tgt = $base_folder . DIRECTORY_SEPARATOR . $folder; if (is_dir($tgt)) { $this->SetDirectory($tgt); break; } } } else { $folder_path = dirname($picked_filepath); $picked_filename = basename($picked_filepath); $this->SetDirectory($folder_path); $this->SetFilename($picked_filename); } }