質問編集履歴

2

送信元HTMLを追記いたしました。

2020/12/03 15:06

投稿

lnavi.bex810vh
lnavi.bex810vh

スコア12

test CHANGED
File without changes
test CHANGED
@@ -8,650 +8,560 @@
8
8
 
9
9
 
10
10
 
11
+ ```~省略~
12
+
13
+ $main_pic=$_FILES['main_pic'];
14
+
15
+ if(empty($main_pic)==false)
16
+
17
+ {
18
+
19
+ $main_pic_ex=strrchr($main_pic['name'],'.');
20
+
21
+ $main_pic_name=random_string(50);
22
+
23
+
24
+
25
+ if($main_pic['size']>5000000)
26
+
27
+ {
28
+
29
+ print 'メイン画像が大きすぎます。最大でも5MB未満にして下さい。<br />';
30
+
31
+ }
32
+
33
+
34
+
35
+ $main_img=$main_pic_name.$main_pic_ex;
36
+
37
+ move_uploaded_file($main_pic['tmp_name'],'./mem_img/'.$main_img);
38
+
39
+
40
+
41
+ $main_rpath=realpath('./mem_img/');
42
+
43
+ $main_org=$main_rpath.'\'.$main_img;
44
+
45
+
46
+
47
+ // 縦横、200pxに収まるように縮小したい
48
+
49
+ $width = 200;
50
+
51
+ $height = 200;
52
+
53
+ $image = new Imagick($main_org);
54
+
55
+ // オリジナルのサイズ取得
56
+
57
+ $width_org = $image->getImageWidth();
58
+
59
+ $height_org = $image->getImageHeight();
60
+
61
+ // 縮小比率を計算
62
+
63
+ $ratio = $width_org / $height_org;
64
+
65
+ if ($width / $height > $ratio) {
66
+
67
+ $width = $height * $ratio;
68
+
69
+ } else {
70
+
71
+ $height = $width / $ratio;
72
+
73
+ }
74
+
75
+ // 縮小実行
76
+
77
+ $image->scaleImage($width, $height);
78
+
79
+ // 保存
80
+
81
+ $image->setCompressionQuality(80);
82
+
83
+ //保存先を指定
84
+
85
+ $thum_rpath=realpath('./mem_img/thum/');
86
+
87
+ $thum_org=$thum_rpath.'\'.'s00_'.$main_img;
88
+
89
+
90
+
91
+ $image->writeImage($thum_org);
92
+
93
+ $image->clear();
94
+
95
+ $url='http://localhost/idol/mem_img/thum/s00_'.$main_img;
96
+
97
+ print '<img src="'.$url.'">';
98
+
99
+ print '<br />';
100
+
101
+
102
+
103
+ // Large画像生成
104
+
105
+ $width = 800;
106
+
107
+ $height = 800;
108
+
109
+ $image = new Imagick($main_org);
110
+
111
+ // オリジナルのサイズ取得
112
+
113
+ $width_org = $image->getImageWidth();
114
+
115
+ $height_org = $image->getImageHeight();
116
+
117
+ // 縮小比率を計算
118
+
119
+ $ratio = $width_org / $height_org;
120
+
121
+ if ($width / $height > $ratio) {
122
+
123
+ $width = $height * $ratio;
124
+
125
+ } else {
126
+
127
+ $height = $width / $ratio;
128
+
129
+ }
130
+
131
+ // 縮小実行
132
+
133
+ $image->scaleImage($width, $height);
134
+
135
+ // 保存
136
+
137
+ $image->setCompressionQuality(80);
138
+
139
+ //保存先を指定
140
+
141
+ $thum_rpath=realpath('./mem_img/large/');
142
+
143
+ $thum_org=$thum_rpath.'\'.'l00_'.$main_img;
144
+
145
+
146
+
147
+ $image->writeImage($thum_org);
148
+
149
+ $image->clear();
150
+
151
+ print '<input type="hidden" name="main_pic" value="'.$main_img.'">';
152
+
153
+ }
154
+
155
+ else
156
+
157
+ {
158
+
159
+ print 'ファイルが選択されていません。<br />';
160
+
161
+ }
162
+
163
+
164
+
165
+
166
+
167
+ $pic1=$_FILES['pic1'];
168
+
169
+
170
+
171
+ if(empty($pic1)==false)
172
+
173
+ {
174
+
175
+
176
+
177
+ $pic1_ex=strrchr($pic1['name'],'.');
178
+
179
+ $pic1_name=random_string(50);
180
+
181
+
182
+
183
+ if($pic1['size']>5000000)
184
+
185
+ {
186
+
187
+ print '画像1が大きすぎます。最大でも5MB未満にして下さい。<br />';
188
+
189
+ }
190
+
191
+
192
+
193
+ $pic1_img=$pic1_name.$pic1_ex;
194
+
195
+ move_uploaded_file($pic1['tmp_name'],'./mem_img/'.$pic1_img);
196
+
197
+
198
+
199
+ $pic1_rpath=realpath('./mem_img/');
200
+
201
+ $pic1_org=$pic1_rpath.'\'.$pic1_img;
202
+
203
+
204
+
205
+ // 縦横、200pxに収まるように縮小したい
206
+
207
+ $width = 200;
208
+
209
+ $height = 200;
210
+
211
+ $image = new Imagick($pic1_org);//             <=ココ
212
+
213
+ // オリジナルのサイズ取得
214
+
215
+ $width_org = $image->getImageWidth();
216
+
217
+ $height_org = $image->getImageHeight();
218
+
219
+ // 縮小比率を計算
220
+
221
+ $ratio = $width_org / $height_org;
222
+
223
+ if ($width / $height > $ratio) {
224
+
225
+ $width = $height * $ratio;
226
+
227
+ } else {
228
+
229
+ $height = $width / $ratio;
230
+
231
+ }
232
+
233
+ // 縮小実行
234
+
235
+ $image->scaleImage($width, $height);
236
+
237
+ // 保存
238
+
239
+ $image->setCompressionQuality(80);
240
+
241
+ //保存先を指定
242
+
243
+ $thum_rpath=realpath('./mem_img/thum/');
244
+
245
+ $thum_org=$thum_rpath.'\'.'s01_'.$pic1_img;
246
+
247
+
248
+
249
+ $image->writeImage($thum_org);
250
+
251
+ $image->clear();
252
+
253
+ $url='http://localhost/idol/mem_img/thum/s01_'.$pic1_img;
254
+
255
+ print '<img src="'.$url.'">';
256
+
257
+ print '<br />';
258
+
259
+
260
+
261
+ // Large画像生成
262
+
263
+ $width = 800;
264
+
265
+ $height = 800;
266
+
267
+ $image = new Imagick($pic1_org);
268
+
269
+ // オリジナルのサイズ取得
270
+
271
+ $width_org = $image->getImageWidth();
272
+
273
+ $height_org = $image->getImageHeight();
274
+
275
+ // 縮小比率を計算
276
+
277
+ $ratio = $width_org / $height_org;
278
+
279
+ if ($width / $height > $ratio) {
280
+
281
+ $width = $height * $ratio;
282
+
283
+ } else {
284
+
285
+ $height = $width / $ratio;
286
+
287
+ }
288
+
289
+ // 縮小実行
290
+
291
+ $image->scaleImage($width, $height);
292
+
293
+ // 保存
294
+
295
+ $image->setCompressionQuality(80);
296
+
297
+ //保存先を指定
298
+
299
+ $thum_rpath=realpath('./mem_img/large/');
300
+
301
+ $thum_org=$thum_rpath.'\'.'l01_'.$pic1_img;
302
+
303
+
304
+
305
+ $image->writeImage($thum_org);
306
+
307
+ $image->clear();
308
+
309
+ print '<input type="hidden" name="pic1" value="'.$pic1_img.'">';
310
+
311
+
312
+
313
+ }else
314
+
315
+ {
316
+
317
+ print 'ファイルが選択されていません。<br />';
318
+
319
+ }
320
+
321
+
322
+
323
+ $pic2=$_FILES['pic2'];
324
+
325
+ if(empty($pic2)==false)
326
+
327
+ {
328
+
329
+ $pic2_ex=strrchr($pic2['name'],'.');
330
+
331
+ $pic2_name=random_string(50);
332
+
333
+
334
+
335
+ if($pic2['size']>5000000)
336
+
337
+ {
338
+
339
+ print '画像2が大きすぎます。最大でも5MB未満にして下さい。<br />';
340
+
341
+ }
342
+
343
+
344
+
345
+ $pic2_img=$pic2_name.$pic2_ex;
346
+
347
+ move_uploaded_file($pic2['tmp_name'],'./mem_img/'.$pic2_img);
348
+
349
+
350
+
351
+ $pic2_rpath=realpath('./mem_img/');
352
+
353
+ $pic2_org=$pic2_rpath.'\'.$pic2_img;
354
+
355
+
356
+
357
+ // 縦横、200pxに収まるように縮小したい
358
+
359
+ $width = 200;
360
+
361
+ $height = 200;
362
+
363
+ $image = new Imagick($pic2_org);
364
+
365
+ // オリジナルのサイズ取得
366
+
367
+ $width_org = $image->getImageWidth();
368
+
369
+ $height_org = $image->getImageHeight();
370
+
371
+ // 縮小比率を計算
372
+
373
+ $ratio = $width_org / $height_org;
374
+
375
+ if ($width / $height > $ratio) {
376
+
377
+ $width = $height * $ratio;
378
+
379
+ } else {
380
+
381
+ $height = $width / $ratio;
382
+
383
+ }
384
+
385
+ // 縮小実行
386
+
387
+ $image->scaleImage($width, $height);
388
+
389
+ // 保存
390
+
391
+ $image->setCompressionQuality(80);
392
+
393
+ //保存先を指定
394
+
395
+ $thum_rpath=realpath('./mem_img/thum/');
396
+
397
+ $thum_org=$thum_rpath.'\'.'s02_'.$pic2_img;
398
+
399
+
400
+
401
+ $image->writeImage($thum_org);
402
+
403
+ $image->clear();
404
+
405
+ $url='http://localhost/idol/mem_img/thum/s02_'.$pic2_img;
406
+
407
+ print '<img src="'.$url.'">';
408
+
409
+ print '<br />';
410
+
411
+
412
+
413
+ // Large画像生成
414
+
415
+ $width = 800;
416
+
417
+ $height = 800;
418
+
419
+ $image = new Imagick($pic2_org);
420
+
421
+ // オリジナルのサイズ取得
422
+
423
+ $width_org = $image->getImageWidth();
424
+
425
+ $height_org = $image->getImageHeight();
426
+
427
+ // 縮小比率を計算
428
+
429
+ $ratio = $width_org / $height_org;
430
+
431
+ if ($width / $height > $ratio) {
432
+
433
+ $width = $height * $ratio;
434
+
435
+ } else {
436
+
437
+ $height = $width / $ratio;
438
+
439
+ }
440
+
441
+ // 縮小実行
442
+
443
+ $image->scaleImage($width, $height);
444
+
445
+ // 保存
446
+
447
+ $image->setCompressionQuality(80);
448
+
449
+ //保存先を指定
450
+
451
+ $thum_rpath=realpath('./mem_img/large/');
452
+
453
+ $thum_org=$thum_rpath.'\'.'l02_'.$pic2_img;
454
+
455
+
456
+
457
+ $image->writeImage($thum_org);
458
+
459
+ $image->clear();
460
+
461
+ print '<input type="hidden" name="pic2" value="'.$pic2_img.'">';
462
+
463
+ }
464
+
465
+ else
466
+
467
+ {
468
+
469
+ print 'ファイルが選択されていません。<br />';
470
+
471
+ }
472
+
473
+
474
+
475
+ ~省略~
476
+
477
+
478
+
479
+ <<<送信元のHTML>>>
480
+
481
+
482
+
483
+ <?php
484
+
485
+ require_once('login_tmp.php');
486
+
487
+ ?>
488
+
489
+ <!DOCTYPE html>
490
+
491
+ <html>
492
+
493
+ <head><meta charset=UTF-8>
494
+
495
+ <title>プロフィール登録</title>
496
+
497
+ </head>
498
+
499
+ <body>
500
+
501
+ <h3>プロフィール登録</h3><br />
502
+
503
+ <form name="regist_profile" method="post" action="regist_profile_check.php" enctype="multipart/form-data"><br />
504
+
505
+ お住いの都道府県<br />
506
+
507
+ <select name="pref_id">
508
+
509
+ <option value="" selected>都道府県</option>
510
+
511
+ <option value="1">北海道</option>
512
+
513
+ <option value="2">青森県</option>
514
+
515
+ <option value="3">岩手県</option>
516
+
517
+ <option value="4">宮城県</option>
518
+
519
+ <option value="5">秋田県</option>
520
+
521
+ <option value="6">山形県</option>
522
+
523
+ ~省略~
524
+
525
+ <option value="42">長崎県</option>
526
+
527
+ <option value="43">熊本県</option>
528
+
529
+ <option value="44">大分県</option>
530
+
531
+ <option value="45">宮崎県</option>
532
+
533
+ <option value="46">鹿児島県</option>
534
+
535
+ <option value="47">沖縄県</option>
536
+
537
+ </select><br />
538
+
539
+ メインの画像を選んでください。<br />
540
+
541
+ <input type="file" name="main_pic" style="width:400px"><br />
542
+
543
+ その他の画像1を選んでください。<br />
544
+
545
+ <input type="file" name="pic1" style="width:400px"><br />
546
+
547
+ その他の画像2を選んでください。<br />
548
+
549
+ <input type="file" name="pic2" style="width:400px"><br />
550
+
551
+ その他の画像3を選んでください。<br />
552
+
553
+ <input type="file" name="pic3" style="width:400px"><br />
554
+
555
+ <textarea name="appeal" rows="4" cols="40">ここにアピール文を入力してください。</textarea><br />
556
+
557
+ <input type="submit" value="送信">
558
+
559
+ </form>
560
+
561
+
562
+
563
+ </body>
564
+
565
+ </html>
566
+
11
567
  ```
12
-
13
- 送信元のHTML
14
-
15
-
16
-
17
- <?php
18
-
19
- require_once('login_tmp.php');
20
-
21
- ?>
22
-
23
- <!DOCTYPE html>
24
-
25
- <html>
26
-
27
- <head><meta charset=UTF-8>
28
-
29
- <title>プロフィール登録</title>
30
-
31
- </head>
32
-
33
- <body>
34
-
35
- <h3>プロフィール登録</h3><br />
36
-
37
- <form name="regist_profile" method="post" action="regist_profile_check.php" enctype="multipart/form-data"><br />
38
-
39
- お住いの都道府県<br />
40
-
41
- <select name="pref_id">
42
-
43
- <option value="" selected>都道府県</option>
44
-
45
- <option value="1">北海道</option>
46
-
47
- <option value="2">青森県</option>
48
-
49
- <option value="3">岩手県</option>
50
-
51
- <option value="4">宮城県</option>
52
-
53
- <option value="5">秋田県</option>
54
-
55
- <option value="6">山形県</option>
56
-
57
- ~省略~
58
-
59
- <option value="42">長崎県</option>
60
-
61
- <option value="43">熊本県</option>
62
-
63
- <option value="44">大分県</option>
64
-
65
- <option value="45">宮崎県</option>
66
-
67
- <option value="46">鹿児島県</option>
68
-
69
- <option value="47">沖縄県</option>
70
-
71
- </select><br />
72
-
73
- メインの画像を選んでください。<br />
74
-
75
- <input type="file" name="main_pic" style="width:400px"><br />
76
-
77
- その他の画像1を選んでください。<br />
78
-
79
- <input type="file" name="pic1" style="width:400px"><br />
80
-
81
- その他の画像2を選んでください。<br />
82
-
83
- <input type="file" name="pic2" style="width:400px"><br />
84
-
85
- その他の画像3を選んでください。<br />
86
-
87
- <input type="file" name="pic3" style="width:400px"><br />
88
-
89
- <textarea name="appeal" rows="4" cols="40">ここにアピール文を入力してください。</textarea><br />
90
-
91
- <input type="submit" value="送信">
92
-
93
- </form>
94
-
95
-
96
-
97
- </body>
98
-
99
- </html>
100
-
101
- ~省略~
102
-
103
- $main_pic=$_FILES['main_pic'];
104
-
105
- if(empty($main_pic)==false)
106
-
107
- {
108
-
109
- $main_pic_ex=strrchr($main_pic['name'],'.');
110
-
111
- $main_pic_name=random_string(50);
112
-
113
-
114
-
115
- if($main_pic['size']>5000000)
116
-
117
- {
118
-
119
- print 'メイン画像が大きすぎます。最大でも5MB未満にして下さい。<br />';
120
-
121
- }
122
-
123
-
124
-
125
- $main_img=$main_pic_name.$main_pic_ex;
126
-
127
- move_uploaded_file($main_pic['tmp_name'],'./mem_img/'.$main_img);
128
-
129
-
130
-
131
- $main_rpath=realpath('./mem_img/');
132
-
133
- $main_org=$main_rpath.'\'.$main_img;
134
-
135
-
136
-
137
- // 縦横、200pxに収まるように縮小したい
138
-
139
- $width = 200;
140
-
141
- $height = 200;
142
-
143
- $image = new Imagick($main_org);
144
-
145
- // オリジナルのサイズ取得
146
-
147
- $width_org = $image->getImageWidth();
148
-
149
- $height_org = $image->getImageHeight();
150
-
151
- // 縮小比率を計算
152
-
153
- $ratio = $width_org / $height_org;
154
-
155
- if ($width / $height > $ratio) {
156
-
157
- $width = $height * $ratio;
158
-
159
- } else {
160
-
161
- $height = $width / $ratio;
162
-
163
- }
164
-
165
- // 縮小実行
166
-
167
- $image->scaleImage($width, $height);
168
-
169
- // 保存
170
-
171
- $image->setCompressionQuality(80);
172
-
173
- //保存先を指定
174
-
175
- $thum_rpath=realpath('./mem_img/thum/');
176
-
177
- $thum_org=$thum_rpath.'\'.'s00_'.$main_img;
178
-
179
-
180
-
181
- $image->writeImage($thum_org);
182
-
183
- $image->clear();
184
-
185
- $url='http://localhost/idol/mem_img/thum/s00_'.$main_img;
186
-
187
- print '<img src="'.$url.'">';
188
-
189
- print '<br />';
190
-
191
-
192
-
193
- // Large画像生成
194
-
195
- $width = 800;
196
-
197
- $height = 800;
198
-
199
- $image = new Imagick($main_org);
200
-
201
- // オリジナルのサイズ取得
202
-
203
- $width_org = $image->getImageWidth();
204
-
205
- $height_org = $image->getImageHeight();
206
-
207
- // 縮小比率を計算
208
-
209
- $ratio = $width_org / $height_org;
210
-
211
- if ($width / $height > $ratio) {
212
-
213
- $width = $height * $ratio;
214
-
215
- } else {
216
-
217
- $height = $width / $ratio;
218
-
219
- }
220
-
221
- // 縮小実行
222
-
223
- $image->scaleImage($width, $height);
224
-
225
- // 保存
226
-
227
- $image->setCompressionQuality(80);
228
-
229
- //保存先を指定
230
-
231
- $thum_rpath=realpath('./mem_img/large/');
232
-
233
- $thum_org=$thum_rpath.'\'.'l00_'.$main_img;
234
-
235
-
236
-
237
- $image->writeImage($thum_org);
238
-
239
- $image->clear();
240
-
241
- print '<input type="hidden" name="main_pic" value="'.$main_img.'">';
242
-
243
- }
244
-
245
- else
246
-
247
- {
248
-
249
- print 'ファイルが選択されていません。<br />';
250
-
251
- }
252
-
253
-
254
-
255
-
256
-
257
- $pic1=$_FILES['pic1'];
258
-
259
-
260
-
261
- if(empty($pic1)==false)
262
-
263
- {
264
-
265
-
266
-
267
- $pic1_ex=strrchr($pic1['name'],'.');
268
-
269
- $pic1_name=random_string(50);
270
-
271
-
272
-
273
- if($pic1['size']>5000000)
274
-
275
- {
276
-
277
- print '画像1が大きすぎます。最大でも5MB未満にして下さい。<br />';
278
-
279
- }
280
-
281
-
282
-
283
- $pic1_img=$pic1_name.$pic1_ex;
284
-
285
- move_uploaded_file($pic1['tmp_name'],'./mem_img/'.$pic1_img);
286
-
287
-
288
-
289
- $pic1_rpath=realpath('./mem_img/');
290
-
291
- $pic1_org=$pic1_rpath.'\'.$pic1_img;
292
-
293
-
294
-
295
- // 縦横、200pxに収まるように縮小したい
296
-
297
- $width = 200;
298
-
299
- $height = 200;
300
-
301
- $image = new Imagick($pic1_org);//             <=ココ
302
-
303
- // オリジナルのサイズ取得
304
-
305
- $width_org = $image->getImageWidth();
306
-
307
- $height_org = $image->getImageHeight();
308
-
309
- // 縮小比率を計算
310
-
311
- $ratio = $width_org / $height_org;
312
-
313
- if ($width / $height > $ratio) {
314
-
315
- $width = $height * $ratio;
316
-
317
- } else {
318
-
319
- $height = $width / $ratio;
320
-
321
- }
322
-
323
- // 縮小実行
324
-
325
- $image->scaleImage($width, $height);
326
-
327
- // 保存
328
-
329
- $image->setCompressionQuality(80);
330
-
331
- //保存先を指定
332
-
333
- $thum_rpath=realpath('./mem_img/thum/');
334
-
335
- $thum_org=$thum_rpath.'\'.'s01_'.$pic1_img;
336
-
337
-
338
-
339
- $image->writeImage($thum_org);
340
-
341
- $image->clear();
342
-
343
- $url='http://localhost/idol/mem_img/thum/s01_'.$pic1_img;
344
-
345
- print '<img src="'.$url.'">';
346
-
347
- print '<br />';
348
-
349
-
350
-
351
- // Large画像生成
352
-
353
- $width = 800;
354
-
355
- $height = 800;
356
-
357
- $image = new Imagick($pic1_org);
358
-
359
- // オリジナルのサイズ取得
360
-
361
- $width_org = $image->getImageWidth();
362
-
363
- $height_org = $image->getImageHeight();
364
-
365
- // 縮小比率を計算
366
-
367
- $ratio = $width_org / $height_org;
368
-
369
- if ($width / $height > $ratio) {
370
-
371
- $width = $height * $ratio;
372
-
373
- } else {
374
-
375
- $height = $width / $ratio;
376
-
377
- }
378
-
379
- // 縮小実行
380
-
381
- $image->scaleImage($width, $height);
382
-
383
- // 保存
384
-
385
- $image->setCompressionQuality(80);
386
-
387
- //保存先を指定
388
-
389
- $thum_rpath=realpath('./mem_img/large/');
390
-
391
- $thum_org=$thum_rpath.'\'.'l01_'.$pic1_img;
392
-
393
-
394
-
395
- $image->writeImage($thum_org);
396
-
397
- $image->clear();
398
-
399
- print '<input type="hidden" name="pic1" value="'.$pic1_img.'">';
400
-
401
-
402
-
403
- }else
404
-
405
- {
406
-
407
- print 'ファイルが選択されていません。<br />';
408
-
409
- }
410
-
411
-
412
-
413
- $pic2=$_FILES['pic2'];
414
-
415
- if(empty($pic2)==false)
416
-
417
- {
418
-
419
- $pic2_ex=strrchr($pic2['name'],'.');
420
-
421
- $pic2_name=random_string(50);
422
-
423
-
424
-
425
- if($pic2['size']>5000000)
426
-
427
- {
428
-
429
- print '画像2が大きすぎます。最大でも5MB未満にして下さい。<br />';
430
-
431
- }
432
-
433
-
434
-
435
- $pic2_img=$pic2_name.$pic2_ex;
436
-
437
- move_uploaded_file($pic2['tmp_name'],'./mem_img/'.$pic2_img);
438
-
439
-
440
-
441
- $pic2_rpath=realpath('./mem_img/');
442
-
443
- $pic2_org=$pic2_rpath.'\'.$pic2_img;
444
-
445
-
446
-
447
- // 縦横、200pxに収まるように縮小したい
448
-
449
- $width = 200;
450
-
451
- $height = 200;
452
-
453
- $image = new Imagick($pic2_org);
454
-
455
- // オリジナルのサイズ取得
456
-
457
- $width_org = $image->getImageWidth();
458
-
459
- $height_org = $image->getImageHeight();
460
-
461
- // 縮小比率を計算
462
-
463
- $ratio = $width_org / $height_org;
464
-
465
- if ($width / $height > $ratio) {
466
-
467
- $width = $height * $ratio;
468
-
469
- } else {
470
-
471
- $height = $width / $ratio;
472
-
473
- }
474
-
475
- // 縮小実行
476
-
477
- $image->scaleImage($width, $height);
478
-
479
- // 保存
480
-
481
- $image->setCompressionQuality(80);
482
-
483
- //保存先を指定
484
-
485
- $thum_rpath=realpath('./mem_img/thum/');
486
-
487
- $thum_org=$thum_rpath.'\'.'s02_'.$pic2_img;
488
-
489
-
490
-
491
- $image->writeImage($thum_org);
492
-
493
- $image->clear();
494
-
495
- $url='http://localhost/idol/mem_img/thum/s02_'.$pic2_img;
496
-
497
- print '<img src="'.$url.'">';
498
-
499
- print '<br />';
500
-
501
-
502
-
503
- // Large画像生成
504
-
505
- $width = 800;
506
-
507
- $height = 800;
508
-
509
- $image = new Imagick($pic2_org);
510
-
511
- // オリジナルのサイズ取得
512
-
513
- $width_org = $image->getImageWidth();
514
-
515
- $height_org = $image->getImageHeight();
516
-
517
- // 縮小比率を計算
518
-
519
- $ratio = $width_org / $height_org;
520
-
521
- if ($width / $height > $ratio) {
522
-
523
- $width = $height * $ratio;
524
-
525
- } else {
526
-
527
- $height = $width / $ratio;
528
-
529
- }
530
-
531
- // 縮小実行
532
-
533
- $image->scaleImage($width, $height);
534
-
535
- // 保存
536
-
537
- $image->setCompressionQuality(80);
538
-
539
- //保存先を指定
540
-
541
- $thum_rpath=realpath('./mem_img/large/');
542
-
543
- $thum_org=$thum_rpath.'\'.'l02_'.$pic2_img;
544
-
545
-
546
-
547
- $image->writeImage($thum_org);
548
-
549
- $image->clear();
550
-
551
- print '<input type="hidden" name="pic2" value="'.$pic2_img.'">';
552
-
553
- }
554
-
555
- else
556
-
557
- {
558
-
559
- print 'ファイルが選択されていません。<br />';
560
-
561
- }
562
-
563
-
564
-
565
- ~省略~
566
-
567
-
568
-
569
- <<<送信元のHTML>>>
570
-
571
-
572
-
573
- <?php
574
-
575
- require_once('login_tmp.php');
576
-
577
- ?>
578
-
579
- <!DOCTYPE html>
580
-
581
- <html>
582
-
583
- <head><meta charset=UTF-8>
584
-
585
- <title>プロフィール登録</title>
586
-
587
- </head>
588
-
589
- <body>
590
-
591
- <h3>プロフィール登録</h3><br />
592
-
593
- <form name="regist_profile" method="post" action="regist_profile_check.php" enctype="multipart/form-data"><br />
594
-
595
- お住いの都道府県<br />
596
-
597
- <select name="pref_id">
598
-
599
- <option value="" selected>都道府県</option>
600
-
601
- <option value="1">北海道</option>
602
-
603
- <option value="2">青森県</option>
604
-
605
- <option value="3">岩手県</option>
606
-
607
- <option value="4">宮城県</option>
608
-
609
- <option value="5">秋田県</option>
610
-
611
- <option value="6">山形県</option>
612
-
613
- ~省略~
614
-
615
- <option value="42">長崎県</option>
616
-
617
- <option value="43">熊本県</option>
618
-
619
- <option value="44">大分県</option>
620
-
621
- <option value="45">宮崎県</option>
622
-
623
- <option value="46">鹿児島県</option>
624
-
625
- <option value="47">沖縄県</option>
626
-
627
- </select><br />
628
-
629
- メインの画像を選んでください。<br />
630
-
631
- <input type="file" name="main_pic" style="width:400px"><br />
632
-
633
- その他の画像1を選んでください。<br />
634
-
635
- <input type="file" name="pic1" style="width:400px"><br />
636
-
637
- その他の画像2を選んでください。<br />
638
-
639
- <input type="file" name="pic2" style="width:400px"><br />
640
-
641
- その他の画像3を選んでください。<br />
642
-
643
- <input type="file" name="pic3" style="width:400px"><br />
644
-
645
- <textarea name="appeal" rows="4" cols="40">ここにアピール文を入力してください。</textarea><br />
646
-
647
- <input type="submit" value="送信">
648
-
649
- </form>
650
-
651
-
652
-
653
- </body>
654
-
655
- </html>
656
-
657
- ```

1

送信元HTMLを追記いたしました。

2020/12/03 15:06

投稿

lnavi.bex810vh
lnavi.bex810vh

スコア12

test CHANGED
File without changes
test CHANGED
@@ -10,8 +10,96 @@
10
10
 
11
11
  ```
12
12
 
13
+ 送信元のHTML
14
+
15
+
16
+
17
+ <?php
18
+
19
+ require_once('login_tmp.php');
20
+
21
+ ?>
22
+
23
+ <!DOCTYPE html>
24
+
25
+ <html>
26
+
27
+ <head><meta charset=UTF-8>
28
+
29
+ <title>プロフィール登録</title>
30
+
31
+ </head>
32
+
33
+ <body>
34
+
35
+ <h3>プロフィール登録</h3><br />
36
+
37
+ <form name="regist_profile" method="post" action="regist_profile_check.php" enctype="multipart/form-data"><br />
38
+
39
+ お住いの都道府県<br />
40
+
41
+ <select name="pref_id">
42
+
43
+ <option value="" selected>都道府県</option>
44
+
45
+ <option value="1">北海道</option>
46
+
47
+ <option value="2">青森県</option>
48
+
49
+ <option value="3">岩手県</option>
50
+
51
+ <option value="4">宮城県</option>
52
+
53
+ <option value="5">秋田県</option>
54
+
55
+ <option value="6">山形県</option>
56
+
13
57
  ~省略~
14
58
 
59
+ <option value="42">長崎県</option>
60
+
61
+ <option value="43">熊本県</option>
62
+
63
+ <option value="44">大分県</option>
64
+
65
+ <option value="45">宮崎県</option>
66
+
67
+ <option value="46">鹿児島県</option>
68
+
69
+ <option value="47">沖縄県</option>
70
+
71
+ </select><br />
72
+
73
+ メインの画像を選んでください。<br />
74
+
75
+ <input type="file" name="main_pic" style="width:400px"><br />
76
+
77
+ その他の画像1を選んでください。<br />
78
+
79
+ <input type="file" name="pic1" style="width:400px"><br />
80
+
81
+ その他の画像2を選んでください。<br />
82
+
83
+ <input type="file" name="pic2" style="width:400px"><br />
84
+
85
+ その他の画像3を選んでください。<br />
86
+
87
+ <input type="file" name="pic3" style="width:400px"><br />
88
+
89
+ <textarea name="appeal" rows="4" cols="40">ここにアピール文を入力してください。</textarea><br />
90
+
91
+ <input type="submit" value="送信">
92
+
93
+ </form>
94
+
95
+
96
+
97
+ </body>
98
+
99
+ </html>
100
+
101
+ ~省略~
102
+
15
103
  $main_pic=$_FILES['main_pic'];
16
104
 
17
105
  if(empty($main_pic)==false)
@@ -476,4 +564,94 @@
476
564
 
477
565
  ~省略~
478
566
 
567
+
568
+
569
+ <<<送信元のHTML>>>
570
+
571
+
572
+
573
+ <?php
574
+
575
+ require_once('login_tmp.php');
576
+
577
+ ?>
578
+
579
+ <!DOCTYPE html>
580
+
581
+ <html>
582
+
583
+ <head><meta charset=UTF-8>
584
+
585
+ <title>プロフィール登録</title>
586
+
587
+ </head>
588
+
589
+ <body>
590
+
591
+ <h3>プロフィール登録</h3><br />
592
+
593
+ <form name="regist_profile" method="post" action="regist_profile_check.php" enctype="multipart/form-data"><br />
594
+
595
+ お住いの都道府県<br />
596
+
597
+ <select name="pref_id">
598
+
599
+ <option value="" selected>都道府県</option>
600
+
601
+ <option value="1">北海道</option>
602
+
603
+ <option value="2">青森県</option>
604
+
605
+ <option value="3">岩手県</option>
606
+
607
+ <option value="4">宮城県</option>
608
+
609
+ <option value="5">秋田県</option>
610
+
611
+ <option value="6">山形県</option>
612
+
613
+ ~省略~
614
+
615
+ <option value="42">長崎県</option>
616
+
617
+ <option value="43">熊本県</option>
618
+
619
+ <option value="44">大分県</option>
620
+
621
+ <option value="45">宮崎県</option>
622
+
623
+ <option value="46">鹿児島県</option>
624
+
625
+ <option value="47">沖縄県</option>
626
+
627
+ </select><br />
628
+
629
+ メインの画像を選んでください。<br />
630
+
631
+ <input type="file" name="main_pic" style="width:400px"><br />
632
+
633
+ その他の画像1を選んでください。<br />
634
+
635
+ <input type="file" name="pic1" style="width:400px"><br />
636
+
637
+ その他の画像2を選んでください。<br />
638
+
639
+ <input type="file" name="pic2" style="width:400px"><br />
640
+
641
+ その他の画像3を選んでください。<br />
642
+
643
+ <input type="file" name="pic3" style="width:400px"><br />
644
+
645
+ <textarea name="appeal" rows="4" cols="40">ここにアピール文を入力してください。</textarea><br />
646
+
647
+ <input type="submit" value="送信">
648
+
649
+ </form>
650
+
651
+
652
+
653
+ </body>
654
+
655
+ </html>
656
+
479
657
  ```