|
@@ -361,29 +361,16 @@ class Helpers {
|
|
if(in_array($type, $allowed) == false || $valid == false) {
|
|
if(in_array($type, $allowed) == false || $valid == false) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- $info = pathinfo($url);
|
|
|
|
|
|
|
|
- // pleroma attachment fix
|
|
|
|
- $url = str_replace(' ', '%20', $url);
|
|
|
|
-
|
|
|
|
- $img = file_get_contents($url, false, stream_context_create(['ssl' => ["verify_peer"=>true,"verify_peer_name"=>true]]));
|
|
|
|
- $file = '/tmp/pxmi-'.str_random(32);
|
|
|
|
- file_put_contents($file, $img);
|
|
|
|
- $fdata = new File($file);
|
|
|
|
- $path = Storage::putFile($storagePath, $fdata, 'public');
|
|
|
|
$media = new Media();
|
|
$media = new Media();
|
|
$media->remote_media = true;
|
|
$media->remote_media = true;
|
|
$media->status_id = $status->id;
|
|
$media->status_id = $status->id;
|
|
$media->profile_id = $status->profile_id;
|
|
$media->profile_id = $status->profile_id;
|
|
$media->user_id = null;
|
|
$media->user_id = null;
|
|
- $media->media_path = $path;
|
|
|
|
- $media->size = $fdata->getSize();
|
|
|
|
- $media->mime = $fdata->getMimeType();
|
|
|
|
|
|
+ $media->media_path = $url;
|
|
|
|
+ $media->remote_url = $url;
|
|
|
|
+ $media->mime = $type;
|
|
$media->save();
|
|
$media->save();
|
|
-
|
|
|
|
- ImageThumbnail::dispatch($media);
|
|
|
|
- ImageOptimize::dispatch($media);
|
|
|
|
- unlink($file);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
$status->viewType();
|
|
$status->viewType();
|