11 lines
400 B
PHP
11 lines
400 B
PHP
|
<?php
|
||
|
|
||
|
function imgproxy($imageURL) {
|
||
|
require "./lib/config.php";
|
||
|
$encodedUrl = rtrim(strtr(base64_encode($imageURL), '+/', '-_'), '=');
|
||
|
$path = "/rs:fit:0:120:1/g:no/{$encodedUrl}.webp";
|
||
|
|
||
|
$signature = rtrim(strtr(base64_encode(hash_hmac('sha256', $imgProxySalt.$path, $imgProxyKey, true)), '+/', '-_'), '=');
|
||
|
return $imgProxyUrl . "/" . $signature . $path;
|
||
|
}
|