mirror of https://github.com/pixelfed/pixelfed.git
Update AP Helpers
This commit is contained in:
parent
8e942994d6
commit
a60f167d49
|
@ -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->media_path = $url;
|
||||||
$media->size = $fdata->getSize();
|
$media->remote_url = $url;
|
||||||
$media->mime = $fdata->getMimeType();
|
$media->mime = $type;
|
||||||
$media->save();
|
$media->save();
|
||||||
|
|
||||||
ImageThumbnail::dispatch($media);
|
|
||||||
ImageOptimize::dispatch($media);
|
|
||||||
unlink($file);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$status->viewType();
|
$status->viewType();
|
||||||
|
|
Loading…
Reference in New Issue