diff --git a/app/Http/Controllers/Auth/SocialAccountsController.php b/app/Http/Controllers/Auth/SocialAccountsController.php index 6ae8b468b943913c01100d9567458e497d59b68f..df695ed140813be3e0a31662ba2b21ff9f987a95 100644 --- a/app/Http/Controllers/Auth/SocialAccountsController.php +++ b/app/Http/Controllers/Auth/SocialAccountsController.php @@ -41,8 +41,8 @@ class SocialAccountsController extends Controller //dd($accountService->user()); //dd(auth()->guard('member')->user()); try { - //$user = Socialite::with($provider)->user(); - $user = Socialite::with($provider)->setHttpClient(new \GuzzleHttp\Client(['curl' => array(CURLOPT_PROXY => 'cache.itb.ac.id', CURLOPT_PROXYPORT => 8080, CURLOPT_PROXYUSERPWD => 'yowinarto:06561330', CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2)]))->user(); + $user = Socialite::with($provider)->user(); + //$user = Socialite::with($provider)->setHttpClient(new \GuzzleHttp\Client(['curl' => array(CURLOPT_PROXY => 'cache.itb.ac.id', CURLOPT_PROXYPORT => 8080, CURLOPT_PROXYUSERPWD => 'yowinarto:06561330', CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2)]))->user(); //dd(Socialite::with($provider)->setHttpClient(new \GuzzleHttp\Client(['curl' => array(CURLOPT_PROXY => 'cache.itb.ac.id', CURLOPT_PROXYPORT => 8080, CURLOPT_PROXYUSERPWD => 'yowinarto:06561330', CURLOPT_SSLVERSION => CURL_SSLVERSION_TLSv1_2 //)]))->user()); } catch (Exception $e) { diff --git a/app/SocialAccountService.php b/app/SocialAccountService.php index 75ba4da7a973dbcf2c4631cafad6935fe25f69af..5a06d30679178dd738b74aabc25e9bece153fc7a 100644 --- a/app/SocialAccountService.php +++ b/app/SocialAccountService.php @@ -6,6 +6,8 @@ use Laravel\Socialite\Contracts\User as ProviderUser; use Illuminate\Support\Facades\Mail; use App\Mail\SendVerificationEmail; +use Image; + class SocialAccountService { public function editGoogleLink(ProviderUser $providerUser, Member $member) @@ -54,8 +56,11 @@ class SocialAccountService case 'linkedin': $member->linkedin_email = $providerUser->getEmail(); $member->name = $providerUser->user["formattedName"]; - $member->company = $providerUser->user["industry"]; + $member->company = (is_null($providerUser->user["industry"])) ? $providerUser->user["industry"] : 'none'; $member->address = $providerUser->user["location"]["name"]; + $random_filename = bin2hex(random_bytes(10)); + Image::make($providerUser->user["pictureUrls"]["values"]["0"])->save(public_path().'\storage\profile_image\\'.$random_filename.'.jpeg'); + $member->profile_image = $random_filename.'.jpeg'; break; default: break; diff --git a/composer.json b/composer.json index c389f57242b9ada405e6c8356b1a5ac989a86768..59cc008ca4e702863ad33c9ded97d266c2c30c01 100644 --- a/composer.json +++ b/composer.json @@ -7,6 +7,7 @@ "require": { "php": ">=7.1.3", "fideloper/proxy": "~4.0", + "intervention/image": "^2.4", "laravel/framework": "5.6.*", "laravel/socialite": "^3.0", "laravel/tinker": "~1.0", @@ -63,4 +64,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index 1906b96608fa55f49faa12ab3520975622b1423c..f500c205e01871b7c99f0197da1c02442b9adee6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "021fda31372ba92222b0fc90695bcfc9", + "content-hash": "252234c048f34448cb0adb6d3a364fe9", "packages": [ { "name": "dnoegel/php-xdg-base-dir", @@ -549,6 +549,76 @@ ], "time": "2018-12-04T20:46:45+00:00" }, + { + "name": "intervention/image", + "version": "2.4.2", + "source": { + "type": "git", + "url": "https://github.com/Intervention/image.git", + "reference": "e82d274f786e3d4b866a59b173f42e716f0783eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Intervention/image/zipball/e82d274f786e3d4b866a59b173f42e716f0783eb", + "reference": "e82d274f786e3d4b866a59b173f42e716f0783eb", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "guzzlehttp/psr7": "~1.1", + "php": ">=5.4.0" + }, + "require-dev": { + "mockery/mockery": "~0.9.2", + "phpunit/phpunit": "^4.8 || ^5.7" + }, + "suggest": { + "ext-gd": "to use GD library based image processing.", + "ext-imagick": "to use Imagick based image processing.", + "intervention/imagecache": "Caching extension for the Intervention Image library" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + }, + "laravel": { + "providers": [ + "Intervention\\Image\\ImageServiceProvider" + ], + "aliases": { + "Image": "Intervention\\Image\\Facades\\Image" + } + } + }, + "autoload": { + "psr-4": { + "Intervention\\Image\\": "src/Intervention/Image" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Oliver Vogel", + "email": "oliver@olivervogel.com", + "homepage": "http://olivervogel.com/" + } + ], + "description": "Image handling and manipulation library with support for Laravel integration", + "homepage": "http://image.intervention.io/", + "keywords": [ + "gd", + "image", + "imagick", + "laravel", + "thumbnail", + "watermark" + ], + "time": "2018-05-29T14:19:03+00:00" + }, { "name": "jakub-onderka/php-console-color", "version": "v0.2",