Skip to content

Commit

Permalink
v3.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
robdekort committed Oct 26, 2021
1 parent 95ba793 commit ae96f18
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,10 @@
# Release Notes

## 3.20.0 (2021-10-26)

### What's improved
- Delete old social images when generating new ones. #156 by @robdekort

## 3.19.0 (2021-10-25)

### What's new
Expand Down
12 changes: 12 additions & 0 deletions app/Jobs/GenerateSocialImagesJob.php
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\File;
use Spatie\Browsershot\Browsershot;

class GenerateSocialImagesJob implements ShouldQueue
Expand All @@ -36,6 +37,17 @@ public function __construct($items)
public function handle()
{
$this->items->each(function($item, $key) {

// Delete any old images remaining.
collect([
public_path("social_images/{$item->get('og_image')}"),
public_path("social_images/{$item->get('twitter_image')}"),
])->each(function ($image) {
if (File::exists($image))
File::delete($image);
});

// Prepare.
$id = $item->id();
$title = Str::of($item->get('title'))->slug('-');
$app_url = config('app.url');
Expand Down
5 changes: 5 additions & 0 deletions dev/CHANGELOG.md
@@ -1,5 +1,10 @@
# Release Notes

## 3.20.0 (2021-10-26)

### What's improved
- Delete old social images when generating new ones. #156 by @robdekort

## 3.19.0 (2021-10-25)

### What's new
Expand Down

0 comments on commit ae96f18

Please sign in to comment.