質問編集履歴
2
なるべく試したことは残すよう、ソースを修正しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,6 +8,8 @@
|
|
8
8
|
const NEW_MAX_WIDTH = 600;
|
9
9
|
const NEW_MAX_HEIGHT = 600;
|
10
10
|
|
11
|
+
$success = true;
|
12
|
+
|
11
13
|
// 拡張子情報の取得・セット
|
12
14
|
$original_filename = $_FILES['image']['tmp_name'];
|
13
15
|
$imginfo = getimagesize($original_filename);
|
@@ -50,8 +52,11 @@
|
|
50
52
|
$new_image = imagecreatefrompng($original_filename);
|
51
53
|
}
|
52
54
|
|
53
|
-
imagecopyresampled($new_image,$emp_img,0,0,0,0,$new_width,$new_height,$width,$height)
|
55
|
+
if( imagecopyresampled($new_image,$emp_img,0,0,0,0,$new_width,$new_height,$width,$height) ){
|
54
|
-
|
56
|
+
$save_image = $new_image['tmp_name'];
|
57
|
+
}else{
|
58
|
+
$success = false;
|
59
|
+
}
|
55
60
|
|
56
61
|
imagedestroy($new_image);
|
57
62
|
imagedestroy($emp_img);
|
@@ -60,15 +65,19 @@
|
|
60
65
|
$save_image = $original_filename;
|
61
66
|
}
|
62
67
|
|
68
|
+
if($success){
|
63
|
-
|
69
|
+
$file_tmp = $save_image;
|
64
|
-
|
70
|
+
$savefile_name = "testimg" . date("YmdHis") . $extension;
|
65
|
-
|
71
|
+
|
66
|
-
|
72
|
+
// アップロードディレクトリ指定
|
67
|
-
|
73
|
+
$file_save = "../" . SAVE_FOLDER_PATH . $savefile_name;
|
68
|
-
|
74
|
+
|
69
|
-
|
75
|
+
// アップロード処理
|
70
|
-
|
76
|
+
if( !(move_uploaded_file($file_tmp, $file_save)) ){
|
77
|
+
$success = false;
|
78
|
+
}
|
79
|
+
}
|
71
80
|
}
|
72
|
-
|
81
|
+
echo $success;
|
73
82
|
?>
|
74
83
|
```
|
1
例示ドメインの修正致しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
```PHP
|
5
5
|
<?php
|
6
|
-
const SERVER_URL = "https://
|
6
|
+
const SERVER_URL = "https://example.com/";
|
7
7
|
const SAVE_FOLDER_PATH = "image/";
|
8
8
|
const NEW_MAX_WIDTH = 600;
|
9
9
|
const NEW_MAX_HEIGHT = 600;
|