|
@@ -23,8 +23,8 @@ $extension = 'png';
|
|
$url = 'http://img.example.com/pretty/image.jpg';
|
|
$url = 'http://img.example.com/pretty/image.jpg';
|
|
$encodedUrl = rtrim(strtr(base64_encode($url), '+/', '-_'), '=');
|
|
$encodedUrl = rtrim(strtr(base64_encode($url), '+/', '-_'), '=');
|
|
|
|
|
|
-$path = sprintf("/%s/%d/%d/%s/%d/%s.%s", $resize, $width, $height, $gravity, $enlarge, $encodedUrl, $extension);
|
|
|
|
|
|
+$path = "/{$resize}/{$width}/{$height}/{$gravity}/{$enlarge}/{$encodedUrl}.{$extension}";
|
|
|
|
|
|
$signature = rtrim(strtr(base64_encode(hash_hmac('sha256', $saltBin.$path, $keyBin, true)), '+/', '-_'), '=');
|
|
$signature = rtrim(strtr(base64_encode(hash_hmac('sha256', $saltBin.$path, $keyBin, true)), '+/', '-_'), '=');
|
|
|
|
|
|
-print(sprintf("/%s%s", $signature, $path));
|
|
|
|
|
|
+print(sprintf("/%s%s", $signature, $path));
|