Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion lib/Thumbor/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,29 @@ public function __construct($server, $secret, $original, $commands)
{
$this->server = $server;
$this->secret = $secret;
$this->original = $original;
$this->original = self::parseOriginalUrl($original);
$this->commands = $commands;
}

/**
* Produce a encoded URL.
* @param string $original URL of original image
* @return string
*/
private function parseOriginalUrl($original)
{
$scheme = parse_url($original, PHP_URL_SCHEME);
if ($scheme) {
$scheme .= '://';
$original = str_replace($scheme, '', $original);
}

$original = implode('/', array_map('rawurlencode', explode('/', $original)));
$original = $scheme . $original;

return $original;
}

/**
* Produce a URL to an image on a Thumbor server according to the specified
* options.
Expand Down