|
@@ -220,20 +220,20 @@ |
|
|
block discarded – undo |
|
220
|
220
|
$path = $data['file']; |
|
221
|
221
|
$ext = pathinfo($path, PATHINFO_EXTENSION); |
|
222
|
222
|
$mimeType = mime_content_type($path); |
|
223
|
|
- $attributes['name'] = pathinfo($path, PATHINFO_FILENAME) . '.' . $ext; |
|
|
223
|
+ $attributes['name'] = pathinfo($path, PATHINFO_FILENAME).'.'.$ext; |
|
224
|
224
|
$attributes['type'] = $mimeType; |
|
225
|
225
|
$content = file_get_contents($path); |
|
226
|
|
- $base64 = 'data:' . $mimeType . ';base64,' . base64_encode($content); |
|
|
226
|
+ $base64 = 'data:'.$mimeType.';base64,'.base64_encode($content); |
|
227
|
227
|
$attributes['data'] = $base64; |
|
228
|
228
|
unset($data['file']); |
|
229
|
229
|
} else if (ArrayUtils::has($data, 'data')) { |
|
230
|
230
|
$finfo = new \finfo(FILEINFO_MIME); |
|
231
|
231
|
list($mimeType, $charset) = explode('; charset=', $finfo->buffer($data['data'])); |
|
232
|
|
- $base64 = 'data:' . $mimeType . ';base64,' . base64_encode($data['data']); |
|
|
232
|
+ $base64 = 'data:'.$mimeType.';base64,'.base64_encode($data['data']); |
|
233
|
233
|
list($type, $subtype) = explode('/', $mimeType); |
|
234
|
234
|
$attributes['data'] = $base64; |
|
235
|
235
|
$attributes['type'] = $mimeType; |
|
236
|
|
- $attributes['name'] = StringUtils::randomString() . '.' . $subtype; |
|
|
236
|
+ $attributes['name'] = StringUtils::randomString().'.'.$subtype; |
|
237
|
237
|
unset($data['data']); |
|
238
|
238
|
} else { |
|
239
|
239
|
throw new \Exception('Missing "file" or "data" attribute.'); |
Please login to merge, or discard this patch.