Skip to content

Commit

Permalink
Download original status images only
Browse files Browse the repository at this point in the history
  • Loading branch information
S1SYPHOS committed Sep 18, 2021
1 parent bde391c commit 75bfba1
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/Entities/Status.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,11 @@ public function downloadMedia(string $directory, bool $overwrite = false): array
# Loop over media attachments
foreach ($this->data['media_attachments'] as $media) {
try {
# Download files
# (1) Original file
$original = basename($media['url']);
# Download original files
$file = basename($media['url']);

if ($this->download($media['url'], $directory, $original, $overwrite)) {
$downloads[] = $original;
}

# (2) Preview image
$thumb = 'thumb_' . basename($media['preview_url']);

if ($this->download($media['preview_url'], $directory, $thumb, $overwrite)) {
$downloads[] = $thumb;
if ($this->download($media['url'], $directory, $file, $overwrite)) {
$downloads[] = $file;
}

} catch (\Exception $e) {}
Expand Down

0 comments on commit 75bfba1

Please sign in to comment.