Further increase in readability
This commit is contained in:
parent
8aeda2e482
commit
dca7348b4e
27
api.php
27
api.php
@ -22,13 +22,13 @@ if (!$timeout || !is_numeric($timeout) || ($timeout>30 || $timeout<1)) {
|
|||||||
|
|
||||||
if ($viewport) {
|
if ($viewport) {
|
||||||
$a = explode('x', $viewport);
|
$a = explode('x', $viewport);
|
||||||
$width = $a[0];
|
$w = $a[0];
|
||||||
$height = $a[1];
|
$h = $a[1];
|
||||||
if ($width) {
|
if ($w) {
|
||||||
$vp = "--width $width ";
|
$vp = "--width $w ";
|
||||||
}
|
}
|
||||||
if ($height) {
|
if ($h) {
|
||||||
$vp.= "--height $height ";
|
$vp .= "--height $h ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,8 +48,6 @@ switch ($type) {
|
|||||||
header('Content-Type: image/jpeg');
|
header('Content-Type: image/jpeg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$hash = $cache.'-'.preg_replace("/[^A-Za-z0-9 ]/", '', $url).'.'.$fileType;
|
$hash = $cache.'-'.preg_replace("/[^A-Za-z0-9 ]/", '', $url).'.'.$fileType;
|
||||||
|
|
||||||
if (!$cache) {
|
if (!$cache) {
|
||||||
@ -87,16 +85,16 @@ if ($resizewidth) {
|
|||||||
|
|
||||||
|
|
||||||
if ($fileType === 'jpg') {
|
if ($fileType === 'jpg') {
|
||||||
$res = imagecreatefromjpeg($file);
|
$result = imagecreatefromjpeg($file);
|
||||||
imagejpeg($res,NULL,100);
|
imagejpeg($result, NULL, 100);
|
||||||
}
|
}
|
||||||
else if ($fileType === 'png') {
|
else if ($fileType === 'png') {
|
||||||
$res = imagecreatefrompng($file);
|
$result = imagecreatefrompng($file);
|
||||||
imagepng($res,NULL,9);
|
imagepng($result, NULL, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
imagedestroy($res);
|
imagedestroy($result);
|
||||||
|
|
||||||
if (!$cache) {
|
if (!$cache) {
|
||||||
unlink($file);
|
unlink($file);
|
||||||
@ -105,7 +103,6 @@ if (!$cache) {
|
|||||||
function isBase64($data) {
|
function isBase64($data) {
|
||||||
if (base64_encode(base64_decode($data, true)) === $data) {
|
if (base64_encode(base64_decode($data, true)) === $data) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user