Changeset 18007 for branches/version-2/data/class/SC_UploadFile.php
- Timestamp:
- 2009/05/15 16:30:40 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2/data/class/SC_UploadFile.php
r17072 r18007 59 59 } 60 60 // サムネイル画像の作成 61 function makeThumb($src_file, $width, $height) { 62 // 一意なIDを取得する。 63 $uniqname = date("mdHi") . "_" . uniqid(""); 64 65 $dst_file = $this->temp_dir . $uniqname; 66 61 function makeThumb($src_file, $width, $height, $dst_file) { 67 62 $objThumb = new gdthumb(); 68 63 $ret = $objThumb->Main($src_file, $width, $height, $dst_file); … … 79 74 // アップロードされたファイルを保存する。 80 75 // FIXME see. http://www.php.net/manual/en/features.file-upload.php 81 function makeTempFile($keyname, $rename = true) {76 function makeTempFile($keyname, $rename = IMAGE_RENAME) { 82 77 $objErr = new SC_CheckError(); 83 78 $cnt = 0; … … 98 93 // 画像ファイルの場合 99 94 if($this->image[$cnt]) { 100 $this->temp_file[$cnt] = $this->makeThumb($_FILES[$keyname]['tmp_name'], $this->width[$cnt], $this->height[$cnt]); 95 // 保存用の画像名を取得する 96 $dst_file = $this->lfGetTmpImageName($rename, $keyname); 97 $this->temp_file[$cnt] = $this->makeThumb($_FILES[$keyname]['tmp_name'], $this->width[$cnt], $this->height[$cnt], $dst_file); 101 98 // 画像ファイル以外の場合 102 99 } else { … … 335 332 return basename($path); 336 333 } 334 335 /** 336 * 一時保存用のファイル名を生成する 337 * 338 * @param string $rename 339 * @param int $keyname 340 * @return strgin $dst_file 341 */ 342 function lfGetTmpImageName($rename, $keyname = "", $uploadfile = ""){ 343 344 if( $rename === true ){ 345 // 一意なIDを取得し、画像名をリネームし保存 346 $uniqname = date("mdHi") . "_" . uniqid(""); 347 } else { 348 // アップロードした画像名で保存 349 $uploadfile = strlen($uploadfile) > 0 ? $uploadfile : $_FILES[$keyname]['name']; 350 $uniqname = preg_replace('/(.+)\.(.+?)$/','$1', $uploadfile); 351 } 352 $dst_file = $this->temp_dir . $uniqname; 353 return $dst_file; 354 } 337 355 } 338 356 ?>
Note: See TracChangeset
for help on using the changeset viewer.