質問編集履歴

3

詳細のエラーを追記

2016/12/13 02:59

投稿

CyberMergina
CyberMergina

スコア295

test CHANGED
File without changes
test CHANGED
@@ -256,22 +256,20 @@
256
256
 
257
257
 
258
258
 
259
- ファイルが開けないと怒られました・・・。
260
-
261
-
262
-
263
- ```php
264
-
265
- object(RuntimeException)[276]
266
-
267
- protected 'message' => string 'Unable to open �����JFIF��H�H�����C� 
268
-
269
-
270
-
271
- ```
272
-
273
-
274
-
275
-
276
-
277
- [一旦ファイルを生成してからアップするしかない?](https://forums.aws.amazon.com/thread.jspa?threadID=77595)みたいですかね・・・
259
+ ハッシュの形式が違う?とかでファイルが開けないと怒られました・・・。
260
+
261
+
262
+
263
+ ```php
264
+
265
+ A sha256 checksum could not be calculated for the provided upload body, because it was not seekable. To prevent this error you can either 1) include the ContentMD5 or ContentSHA256 parameters with your request, 2) use a seekable stream for the body, or 3) wrap the non-seekable stream in a GuzzleHttp\Psr7\CachingStream object. You should be careful though and remember that the CachingStream utilizes PHP temp streams. This means that the stream will be temporarily stored on the local disk.
266
+
267
+
268
+
269
+ ```
270
+
271
+
272
+
273
+
274
+
275
+ [一旦ファイルを生成してからアップする](https://forums.aws.amazon.com/thread.jspa?threadID=77595)方が良いみたいですかね・・・

2

追記1:putObjectでファイルを送るようにしてみる

2016/12/13 02:59

投稿

CyberMergina
CyberMergina

スコア295

test CHANGED
File without changes
test CHANGED
@@ -207,3 +207,71 @@
207
207
  足りない情報等あれば、随時追記させて頂きますので
208
208
 
209
209
  ご教授の程よろしくお願い致します。
210
+
211
+
212
+
213
+
214
+
215
+ ###追記1
216
+
217
+
218
+
219
+ putObjectでアップするように、ソースコードを下記の通り変更してみました。
220
+
221
+
222
+
223
+ ```php
224
+
225
+ private function _createThumnail($fileName){
226
+
227
+ $thumbname = "thumb_".pathinfo($fileName, PATHINFO_FILENAME).".jpg"; //サムネイルのファイル名
228
+
229
+ /* 画像の読み込み */
230
+
231
+ $thumbImg = new Imagick();
232
+
233
+ /* サムネイルの作成 */
234
+
235
+ $thumbImg->readImage(AWS_S3_HOSTNAME.AWS_S3_BUCKET."/xxxx/".$fileName);
236
+
237
+ $thumbImg->thumbnailImage(100, 0);
238
+
239
+ $thumbImg->setImageFormat ("jpeg");
240
+
241
+ try {
242
+
243
+ $ret = $this->Amazon->putObject("xxxx/".$thumbname, $thumbImg->getImageBlob());
244
+
245
+ } catch (Exception $e) {
246
+
247
+ }
248
+
249
+ $thumbImg->clear();
250
+
251
+ return $ret;
252
+
253
+ }
254
+
255
+ ```
256
+
257
+
258
+
259
+ ファイルが開けないと怒られました・・・。
260
+
261
+
262
+
263
+ ```php
264
+
265
+ object(RuntimeException)[276]
266
+
267
+ protected 'message' => string 'Unable to open �����JFIF��H�H�����C� 
268
+
269
+
270
+
271
+ ```
272
+
273
+
274
+
275
+
276
+
277
+ [一旦ファイルを生成してからアップするしかない?](https://forums.aws.amazon.com/thread.jspa?threadID=77595)みたいですかね・・・

1

補足を追記しました。

2016/12/13 02:35

投稿

CyberMergina
CyberMergina

スコア295

test CHANGED
File without changes
test CHANGED
@@ -42,6 +42,12 @@
42
42
 
43
43
  ###該当のソースコード
44
44
 
45
+
46
+
47
+ DocumentController.php
48
+
49
+
50
+
45
51
  ```php
46
52
 
47
53
 
@@ -88,7 +94,11 @@
88
94
 
89
95
 
90
96
 
91
- ```php:AmazonComponent.php
97
+ AmazonComponent.php
98
+
99
+
100
+
101
+ ```php
92
102
 
93
103
  function putObject($key, $file){
94
104