@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | // load dirs in defined order. No recursion. |
| 29 | 29 | foreach ($def['dirs'] as $dir) { |
| 30 | - $dirAbs = __DIR__ . '/' . $def['root'] . '/' . $dir; |
|
| 30 | + $dirAbs = __DIR__ . '/' . $def['root'] . '/' . $dir; |
|
| 31 | 31 | $files = glob($dirAbs . '/*.php'); |
| 32 | 32 | foreach ($files as $file) { |
| 33 | 33 | // only require files that begins with uppercase (A-Z) |
@@ -256,7 +256,7 @@ |
||
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | if (!$success && $options['try-supplied-binary-for-os']) { |
| 259 | - // Try supplied binary (if available for OS, and hash is correct) |
|
| 259 | + // Try supplied binary (if available for OS, and hash is correct) |
|
| 260 | 260 | if (isset(self::$suppliedBinariesInfo[PHP_OS])) { |
| 261 | 261 | $info = self::$suppliedBinariesInfo[PHP_OS]; |
| 262 | 262 | |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | // If other binaries are going to be added, notice that the first argument is what PHP_OS returns. |
| 40 | 40 | // (possible values, see here: https://stackoverflow.com/questions/738823/possible-values-for-php-os) |
| 41 | 41 | private static $suppliedBinariesInfo = [ |
| 42 | - 'WINNT' => [ 'cwebp.exe', '49e9cb98db30bfa27936933e6fd94d407e0386802cb192800d9fd824f6476873'], |
|
| 43 | - 'Darwin' => [ 'cwebp-mac12', 'a06a3ee436e375c89dbc1b0b2e8bd7729a55139ae072ed3f7bd2e07de0ebb379'], |
|
| 44 | - 'SunOS' => [ 'cwebp-sol', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f'], |
|
| 45 | - 'FreeBSD' => [ 'cwebp-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573'], |
|
| 46 | - 'Linux' => [ 'cwebp-linux', '916623e5e9183237c851374d969aebdb96e0edc0692ab7937b95ea67dc3b2568'] |
|
| 42 | + 'WINNT' => ['cwebp.exe', '49e9cb98db30bfa27936933e6fd94d407e0386802cb192800d9fd824f6476873'], |
|
| 43 | + 'Darwin' => ['cwebp-mac12', 'a06a3ee436e375c89dbc1b0b2e8bd7729a55139ae072ed3f7bd2e07de0ebb379'], |
|
| 44 | + 'SunOS' => ['cwebp-sol', '1febaffbb18e52dc2c524cda9eefd00c6db95bc388732868999c0f48deb73b4f'], |
|
| 45 | + 'FreeBSD' => ['cwebp-fbsd', 'e5cbea11c97fadffe221fdf57c093c19af2737e4bbd2cb3cd5e908de64286573'], |
|
| 46 | + 'Linux' => ['cwebp-linux', '916623e5e9183237c851374d969aebdb96e0edc0692ab7937b95ea67dc3b2568'] |
|
| 47 | 47 | ]; |
| 48 | 48 | |
| 49 | 49 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | // Size |
| 77 | 77 | if (!is_null($options['size-in-percentage'])) { |
| 78 | - $sizeSource = filesize($this->source); |
|
| 78 | + $sizeSource = filesize($this->source); |
|
| 79 | 79 | if ($sizeSource !== false) { |
| 80 | 80 | $targetSize = floor($sizeSource * $options['size-in-percentage'] / 100); |
| 81 | 81 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | // We only let near_lossless have effect when lossless is set. |
| 104 | 104 | // otherwise lossless auto would not work as expected |
| 105 | 105 | if ($options['lossless'] === true) { |
| 106 | - $commandOptionsArray[] ='-near_lossless ' . $options['near-lossless']; |
|
| 106 | + $commandOptionsArray[] = '-near_lossless ' . $options['near-lossless']; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | 'It ought to be here: ' . $binaryFile; |
| 318 | 318 | break; |
| 319 | 319 | default: |
| 320 | - $errorMsg .= ' (exit code:' . $returnCode . ').'; |
|
| 320 | + $errorMsg .= ' (exit code:' . $returnCode . ').'; |
|
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | } |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | } elseif ($uploadMaxSize < $fileSize) { |
| 118 | 118 | throw new ConversionFailedException( |
| 119 | 119 | 'File is larger than your max upload (set in your php.ini). File size:' . |
| 120 | - round($fileSize/1024) . ' kb. ' . |
|
| 120 | + round($fileSize / 1024) . ' kb. ' . |
|
| 121 | 121 | 'upload_max_filesize in php.ini: ' . ini_get('upload_max_filesize') . |
| 122 | - ' (parsed as ' . round($uploadMaxSize/1024) . ' kb)' |
|
| 122 | + ' (parsed as ' . round($uploadMaxSize / 1024) . ' kb)' |
|
| 123 | 123 | ); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } elseif ($postMaxSize < $fileSize) { |
| 130 | 130 | throw new ConversionFailedException( |
| 131 | 131 | 'File is larger than your post_max_size limit (set in your php.ini). File size:' . |
| 132 | - round($fileSize/1024) . ' kb. ' . |
|
| 132 | + round($fileSize / 1024) . ' kb. ' . |
|
| 133 | 133 | 'post_max_size in php.ini: ' . ini_get('post_max_size') . |
| 134 | - ' (parsed as ' . round($postMaxSize/1024) . ' kb)' |
|
| 134 | + ' (parsed as ' . round($postMaxSize / 1024) . ' kb)' |
|
| 135 | 135 | ); |
| 136 | 136 | } |
| 137 | 137 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | set_error_handler( |
| 26 | 26 | array('\\WebPConvert\\Helpers\\WarningsIntoExceptions', "warningHandler"), |
| 27 | 27 | E_WARNING | E_USER_WARNING |
| 28 | - ); // E_USER_WARNING E_ALL |
|
| 28 | + ); // E_USER_WARNING E_ALL |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public static function deactivate() |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | /** |
| 100 | 100 | * Prepare options. |
| 101 | 101 | */ |
| 102 | - /* |
|
| 102 | + /* |
|
| 103 | 103 | private function prepareOptions() |
| 104 | 104 | { |
| 105 | 105 | //$defaultOptions = self::$defaultOptions; |
@@ -110,7 +110,7 @@ |
||
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if (($optionName == 'lossless') && ($actualType == 'string') && ($optionValue != 'auto')) { |
|
| 113 | + if (($optionName == 'lossless') && ($actualType == 'string') && ($optionValue != 'auto')) { |
|
| 114 | 114 | throw new InvalidOptionTypeException( |
| 115 | 115 | 'Lossless option must be true, false or "auto". It was set to: "' . $optionValue . '"' |
| 116 | 116 | ); |
@@ -106,14 +106,14 @@ |
||
| 106 | 106 | return false; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - //change the RGB values if you need, but leave alpha at 127 |
|
| 109 | + //change the RGB values if you need, but leave alpha at 127 |
|
| 110 | 110 | $transparent = imagecolorallocatealpha($dst, 255, 255, 255, 127); |
| 111 | 111 | |
| 112 | 112 | if ($transparent === false) { |
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - //simpler than flood fill |
|
| 116 | + //simpler than flood fill |
|
| 117 | 117 | if (imagefilledrectangle($dst, 0, 0, imagesx($image), imagesy($image), $transparent) === false) { |
| 118 | 118 | return false; |
| 119 | 119 | } |
@@ -238,14 +238,14 @@ discard block |
||
| 238 | 238 | $sourceSize = @filesize($source); |
| 239 | 239 | if ($sourceSize !== false) { |
| 240 | 240 | $msg .= ', reducing file size with ' . |
| 241 | - round((filesize($source) - filesize($destination))/filesize($source) * 100) . '% '; |
|
| 241 | + round((filesize($source) - filesize($destination)) / filesize($source) * 100) . '% '; |
|
| 242 | 242 | |
| 243 | 243 | if ($sourceSize < 10000) { |
| 244 | 244 | $msg .= '(went from ' . round(filesize($source)) . ' bytes to '; |
| 245 | 245 | $msg .= round(filesize($destination)) . ' bytes)'; |
| 246 | 246 | } else { |
| 247 | - $msg .= '(went from ' . round(filesize($source)/1024) . ' kb to '; |
|
| 248 | - $msg .= round(filesize($destination)/1024) . ' kb)'; |
|
| 247 | + $msg .= '(went from ' . round(filesize($source) / 1024) . ' kb to '; |
|
| 248 | + $msg .= round(filesize($destination) / 1024) . ' kb)'; |
|
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | 251 | $this->logLn($msg); |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | { |
| 259 | 259 | if ($this->processLosslessAuto && ($this->options['lossless'] === 'auto') && $this->supportsLossless) { |
| 260 | 260 | $destination = $this->destination; |
| 261 | - $destinationLossless = $this->destination . '.lossless.webp'; |
|
| 262 | - $destinationLossy = $this->destination . '.lossy.webp'; |
|
| 261 | + $destinationLossless = $this->destination . '.lossless.webp'; |
|
| 262 | + $destinationLossy = $this->destination . '.lossy.webp'; |
|
| 263 | 263 | |
| 264 | 264 | $this->logLn( |
| 265 | 265 | 'Lossless is set to auto. Converting to both lossless and lossy and selecting the smallest file' |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $this->options['lossless'] = false; |
| 273 | 273 | $this->doActualConvert(); |
| 274 | 274 | $this->logLn('Reduction: ' . |
| 275 | - round((filesize($this->source) - filesize($this->destination))/filesize($this->source) * 100) . '% '); |
|
| 275 | + round((filesize($this->source) - filesize($this->destination)) / filesize($this->source) * 100) . '% '); |
|
| 276 | 276 | |
| 277 | 277 | $this->ln(); |
| 278 | 278 | $this->logLn('Converting to lossless'); |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $this->options['lossless'] = true; |
| 281 | 281 | $this->doActualConvert(); |
| 282 | 282 | $this->logLn('Reduction: ' . |
| 283 | - round((filesize($this->source) - filesize($this->destination))/filesize($this->source) * 100) . '% '); |
|
| 283 | + round((filesize($this->source) - filesize($this->destination)) / filesize($this->source) * 100) . '% '); |
|
| 284 | 284 | |
| 285 | 285 | $this->ln(); |
| 286 | 286 | if (filesize($destinationLossless) > filesize($destinationLossy)) { |
@@ -16,9 +16,9 @@ |
||
| 16 | 16 | { |
| 17 | 17 | return [ |
| 18 | 18 | ['smart-subsample', 'boolean', false], |
| 19 | - ['alpha-quality', 'integer', 80], // alpha quality in lossless mode |
|
| 19 | + ['alpha-quality', 'integer', 80], // alpha quality in lossless mode |
|
| 20 | 20 | ['near-lossless', 'integer', 60], |
| 21 | - ['preset', 'integer', 0], // preset. 0:default, 1:picture, 2:photo, 3:drawing, 4:icon, 5:text, 6:last |
|
| 21 | + ['preset', 'integer', 0], // preset. 0:default, 1:picture, 2:photo, 3:drawing, 4:icon, 5:text, 6:last |
|
| 22 | 22 | ]; |
| 23 | 23 | } |
| 24 | 24 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | $options = array_merge(self::$defaultOptions, $options); |
| 35 | 35 | |
| 36 | 36 | if ($options['set-last-modified-header'] === true) { |
| 37 | - Header::setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", @filemtime($filename)) ." GMT"); |
|
| 37 | + Header::setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s", @filemtime($filename)) . " GMT"); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | if ($options['set-content-type-header'] === true) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | // Check string for something like this: max-age:86400 |
| 54 | 54 | if (preg_match('#max-age\\s*=\\s*(\\d*)#', $options['cache-control-header'], $matches)) { |
| 55 | 55 | $seconds = $matches[1]; |
| 56 | - Header::setHeader('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + intval($seconds))); |
|
| 56 | + Header::setHeader('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + intval($seconds))); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |