Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
[ci skip] [skip ci]
  • Loading branch information
WebDevEtc committed Jul 25, 2020
1 parent 4d85512 commit 37e1ec4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/Controllers/Admin/ManageUploadsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,4 @@ public function deletePostImageConfirmed(int $postId)

return view('blogetc_admin::imageupload.deleted-post-image');
}

}

5 changes: 3 additions & 2 deletions src/Services/PostsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,9 @@ public function search(string $query, $max = 25): Collection
return $this->repository->search($query, $max);
}

public function clearImageSizes(Post $post, array $sizes) {
foreach($sizes as $size) {
public function clearImageSizes(Post $post, array $sizes)
{
foreach ($sizes as $size) {
$post->$size = null;
}

Expand Down
10 changes: 5 additions & 5 deletions src/Services/UploadsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -622,13 +622,14 @@ public function legacyDestroyPost(/* @scrutinizer ignore-unused */ DeleteBlogEtc
return $post;
}

public function deletePostImage(Post $post):array{
public function deletePostImage(Post $post): array
{
$deletedImageSizes = [];
foreach(array_keys(config('blogetc.image_sizes')) as $size) {
foreach (array_keys(config('blogetc.image_sizes')) as $size) {
$imageFilename = $post->$size;
$path = $this->image_destination_path() .'/'. $imageFilename;
$path = $this->image_destination_path().'/'.$imageFilename;

if($imageFilename && file_exists($path) ){
if ($imageFilename && file_exists($path)) {
unlink($path);
$deletedImageSizes[] = $size;
}
Expand All @@ -637,4 +638,3 @@ public function deletePostImage(Post $post):array{
return $deletedImageSizes;
}
}

0 comments on commit 37e1ec4

Please sign in to comment.