Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix: Original Size Url
Browse files Browse the repository at this point in the history
  • Loading branch information
rankarpan committed May 15, 2018
1 parent 2c1dd3a commit 1d2ec19
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/ImageType.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,11 @@ public function url(string $filename = null, $sizes = [], $expirationTime = null
}

$urls = [];
$filename = pathinfo($filename);
$this->expirationTime = empty($expirationTime) ? $this->expirationTime : $expirationTime;

if (empty($sizes) || in_array('original', $sizes)) {
$output = $this->typeConfig->get('original')['path'] . '/' . $filename;
$output = $this->typeConfig->get('original')['path'] . '/' . $filename['basename'];

$storage = Storage::disk($this->originalFileDisk);
if ($this->originalDiskConfig['driver'] === 'local' || empty($this->typeConfig->get('original')['private'])) {
Expand All @@ -200,7 +201,6 @@ public function url(string $filename = null, $sizes = [], $expirationTime = null
}
}

$filename = pathinfo($filename);
$configSizes = $this->typeConfig->get('sizes');

if ($configSizes) {
Expand All @@ -222,14 +222,14 @@ public function temporaryUrl(string $filename = null, $sizes = [], $expirationTi
}

$urls = [];
$filename = pathinfo($filename);
$this->expirationTime = empty($expirationTime) ? $this->expirationTime : $expirationTime;

if (empty($sizes) || in_array('original', $sizes)) {
$output = $this->typeConfig->get('original')['path'] . '/' . $filename;
$output = $this->typeConfig->get('original')['path'] . '/' . $filename['basename'];
$urls['original'] = Storage::disk($this->originalFileDisk)->temporaryUrl($output, Carbon::now()->addMinutes($this->expirationTime));
}

$filename = pathinfo($filename);
$configSizes = $this->typeConfig->get('sizes');

if ($configSizes) {
Expand All @@ -247,14 +247,14 @@ public function temporaryUrl(string $filename = null, $sizes = [], $expirationTi
public function blob(string $filename, $size = null)
{
$output = null;
$filename = pathinfo($filename);

if (empty($size) || $size === 'original') {
$output = $this->typeConfig->get('original')['path'] . '/' . $filename;
$output = $this->typeConfig->get('original')['path'] . '/' . $filename['basename'];
} else {
$configSizes = $this->typeConfig->get('sizes');

if (isset($configSizes[$size])) {
$filename = pathinfo($filename);
$output = $this->output($filename, $size, $configSizes[$size]);
}
}
Expand Down

0 comments on commit 1d2ec19

Please sign in to comment.