Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Commit

Permalink
support external user images
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronpk committed Sep 1, 2018
1 parent c637029 commit 1ac3ece
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
17 changes: 12 additions & 5 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ public function get($username, $format=false) {
"mediaType" => "image/jpeg",
"url" => env('APP_URL')."/storage/images/".$user->username.".jpg",
],
// "image" => [
// "type" => "Image",
// "mediaType" => "image/jpeg",
// "url" => env('APP_URL')."/images/cover-photo.jpg",
// ],
"inbox" => env('APP_URL').$user->inboxPath(),
"outbox" => env('APP_URL').$user->outboxPath(),
"featured" => env('APP_URL').$user->featuredPath(),
Expand All @@ -54,6 +49,18 @@ public function get($username, $format=false) {
]
];

if($user->photo) {
$profile['icon']['url'] = $user->photo;
}

if($user->banner) {
$profile['image'] = [
'type' => 'image',
'mediaType' => 'image/jpeg',
'url' => $user->banner,
];
}

if($user->external_domain) {
// Override some of the properties
$profile['url'] = 'https://' . $user->external_domain;
Expand Down
34 changes: 34 additions & 0 deletions database/migrations/2018_09_01_232403_user_images.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UserImages extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('photo', 512)->nullable();
$table->string('banner', 512)->nullable();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropcolumn('photo');
$table->dropcolumn('banner');
});
}
}

0 comments on commit 1ac3ece

Please sign in to comment.