Skip to content

Commit af13d3c

Browse files
committed
app: renamed ProfilePhotoUploadController to ProfilePhotoController
1 parent 85d745d commit af13d3c

3 files changed

Lines changed: 17 additions & 17 deletions

File tree

app/app/Http/Controllers/ProfileController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use App\Country;
66
use App\AnswerRepository;
77
use App\Region;
8-
use App\Http\Controllers\ProfilePhotoUploadController;
8+
use App\Http\Controllers\ProfilePhotoController;
99
use Illuminate\Http\Request;
1010
use Illuminate\Support\Facades\Validator;
1111
use Illuminate\Support\Facades\Input;
@@ -41,7 +41,7 @@ public static function getProfileView($validator = null)
4141
'address_default' => BaseUser::getDefaultAddress(),
4242
'countries' => $countries,
4343
'required_questions' => $required_questions,
44-
'has_profile_photo' => ProfilePhotoUploadController::hasProfilePhoto(),
44+
'has_profile_photo' => ProfilePhotoController::hasProfilePhoto(),
4545
'num_reviews' => count(AnswerRepository::getReviewedLocations()['location_ids']),
4646
'num_locations_added_by_me' => $num_locations_added_by_me,
4747
'is_internal_user' => BaseUser::isInternal(),

app/app/Http/Controllers/ProfilePhotoUploadController.php renamed to app/app/Http/Controllers/ProfilePhotoController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Illuminate\Support\Facades\Input;
77
use Illuminate\Support\Facades\Redirect;
88

9-
class ProfilePhotoUploadController extends Controller
9+
class ProfilePhotoController extends Controller
1010
{
1111

1212
public function index(Request $request)
@@ -26,12 +26,12 @@ private static function getUploadDirectory()
2626
private static function getProfilePhotoPath()
2727
{
2828
$user = BaseUser::getDbUser();
29-
return ProfilePhotoUploadController::getUploadDirectory() . 'user_' . $user->id . '.jpg';
29+
return ProfilePhotoController::getUploadDirectory() . 'user_' . $user->id . '.jpg';
3030
}
3131

3232
public static function hasProfilePhoto()
3333
{
34-
return file_exists(ProfilePhotoUploadController::getProfilePhotoPath());
34+
return file_exists(ProfilePhotoController::getProfilePhotoPath());
3535
}
3636

3737
/**
@@ -60,7 +60,7 @@ private static function getFileNameFromOriginalName(string $user_id, string $ori
6060
public function photo()
6161
{
6262
if (BaseUser::isSignedIn()) {
63-
$file_path = ProfilePhotoUploadController::getProfilePhotoPath();
63+
$file_path = ProfilePhotoController::getProfilePhotoPath();
6464
return response()->file($file_path);
6565
} else {
6666
return redirect()->intended('signin');
@@ -88,15 +88,15 @@ private static function getPhotoDimensionsFromUploadDimensions($width, $height)
8888

8989
public static function save($image)
9090
{
91-
$destinationPath = ProfilePhotoUploadController::getUploadDirectory();
91+
$destinationPath = ProfilePhotoController::getUploadDirectory();
9292

9393
$user = BaseUser::getDbUser();
9494

9595
$full_path = $destinationPath . 'user_' . $user->id . '.jpg';
9696

9797
$width = imagesx($image);
9898
$height = imagesy($image);
99-
$newDimensions = ProfilePhotoUploadController::getPhotoDimensionsFromUploadDimensions($width, $height);
99+
$newDimensions = ProfilePhotoController::getPhotoDimensionsFromUploadDimensions($width, $height);
100100

101101
// png images can be transparent and the transparent areas are defaulted to black.
102102
// We want the background to default to white.
@@ -129,15 +129,15 @@ public function post(Request $request)
129129
$content = file_get_contents($temp_filename);
130130
$new_image = imagecreatefromstring($content);
131131

132-
return ProfilePhotoUploadController::save($new_image);
132+
return ProfilePhotoController::save($new_image);
133133
} else {
134134
return redirect()->intended('signin');
135135
}
136136
}
137137

138138
public function delete()
139139
{
140-
$file = ProfilePhotoUploadController::getProfilePhotoPath();
140+
$file = ProfilePhotoController::getProfilePhotoPath();
141141
if (!unlink($file)) {
142142
echo ("Error deleting $file");
143143
} else {
@@ -148,12 +148,12 @@ public function delete()
148148
// Rotate Profile Photo
149149
public function rotate()
150150
{
151-
$current_photo = ProfilePhotoUploadController::getProfilePhotoPath();
151+
$current_photo = ProfilePhotoController::getProfilePhotoPath();
152152

153153
$content = file_get_contents($current_photo);
154154
$image = imagecreatefromstring($content);
155155

156156
$new_image = imagerotate($image, -90, 0);
157-
return ProfilePhotoUploadController::save($new_image);
157+
return ProfilePhotoController::save($new_image);
158158
}
159159
}

app/routes/profile.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
Route::post('/', 'ProfileController@save');
66
});
77
Route::group(['prefix' => 'profile-photo-upload'], function () {
8-
Route::get('/', 'ProfilePhotoUploadController@index');
9-
Route::post('/', 'ProfilePhotoUploadController@post');
8+
Route::get('/', 'ProfilePhotoController@index');
9+
Route::post('/', 'ProfilePhotoController@post');
1010
});
1111

12-
Route::get('profile-photo', 'ProfilePhotoUploadController@photo');
13-
Route::post('profile-photo-rotate', 'ProfilePhotoUploadController@rotate');
14-
Route::get('profile-photo-delete', 'ProfilePhotoUploadController@delete');
12+
Route::get('profile-photo', 'ProfilePhotoController@photo');
13+
Route::post('profile-photo-rotate', 'ProfilePhotoController@rotate');
14+
Route::get('profile-photo-delete', 'ProfilePhotoController@delete');

0 commit comments

Comments
 (0)