Further increase in readability

This commit is contained in:
Martin Trobäck 2015-09-28 16:54:29 +02:00
parent 8aeda2e482
commit dca7348b4e

27
api.php
View File

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