@@ -43,7 +43,7 @@ |
||
| 43 | 43 | /** |
| 44 | 44 | * @return string Regex with the mimetypes that are supported by this provider |
| 45 | 45 | */ |
| 46 | - abstract public function getMimeType(): string ; |
|
| 46 | + abstract public function getMimeType(): string; |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Check if a preview can be generated for $path |
@@ -49,11 +49,11 @@ |
||
| 49 | 49 | $tags = $getID3->analyze($tmpPath); |
| 50 | 50 | $this->cleanTmpFiles(); |
| 51 | 51 | $picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null; |
| 52 | - if(is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) { |
|
| 52 | + if (is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) { |
|
| 53 | 53 | $picture = $tags['id3v2']['PIC'][0]['data']; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - if(!is_null($picture)) { |
|
| 56 | + if (!is_null($picture)) { |
|
| 57 | 57 | $image = new \OC_Image(); |
| 58 | 58 | $image->loadFromData($picture); |
| 59 | 59 | |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | return null; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $content = stream_get_contents($content,3000); |
|
| 58 | + $content = stream_get_contents($content, 3000); |
|
| 59 | 59 | |
| 60 | 60 | //don't create previews of empty text files |
| 61 | - if(trim($content) === '') { |
|
| 61 | + if (trim($content) === '') { |
|
| 62 | 62 | return null; |
| 63 | 63 | } |
| 64 | 64 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | |
| 79 | 79 | $canUseTTF = function_exists('imagettftext'); |
| 80 | 80 | |
| 81 | - foreach($lines as $index => $line) { |
|
| 81 | + foreach ($lines as $index => $line) { |
|
| 82 | 82 | $index = $index + 1; |
| 83 | 83 | |
| 84 | 84 | $x = (int) 1; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | imagestring($image, 1, $x, $y, $line, $textColor); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if(($index * $lineSize) >= $maxY) { |
|
| 94 | + if (($index * $lineSize) >= $maxY) { |
|
| 95 | 95 | break; |
| 96 | 96 | } |
| 97 | 97 | } |
@@ -45,20 +45,20 @@ |
||
| 45 | 45 | |
| 46 | 46 | $tmpDir = \OC::$server->getTempManager()->getTempBaseDir(); |
| 47 | 47 | |
| 48 | - $defaultParameters = ' -env:UserInstallation=file://' . escapeshellarg($tmpDir . '/owncloud-' . \OC_Util::getInstanceId() . '/') . ' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '; |
|
| 48 | + $defaultParameters = ' -env:UserInstallation=file://'.escapeshellarg($tmpDir.'/owncloud-'.\OC_Util::getInstanceId().'/').' --headless --nologo --nofirststartwizard --invisible --norestore --convert-to png --outdir '; |
|
| 49 | 49 | $clParameters = \OC::$server->getConfig()->getSystemValue('preview_office_cl_parameters', $defaultParameters); |
| 50 | 50 | |
| 51 | - $exec = $this->cmd . $clParameters . escapeshellarg($tmpDir) . ' ' . escapeshellarg($absPath); |
|
| 51 | + $exec = $this->cmd.$clParameters.escapeshellarg($tmpDir).' '.escapeshellarg($absPath); |
|
| 52 | 52 | |
| 53 | 53 | shell_exec($exec); |
| 54 | 54 | |
| 55 | 55 | //create imagick object from png |
| 56 | 56 | $pngPreview = null; |
| 57 | 57 | try { |
| 58 | - list($dirname, , , $filename) = array_values(pathinfo($absPath)); |
|
| 59 | - $pngPreview = $dirname . '/' . $filename . '.png'; |
|
| 58 | + list($dirname,,, $filename) = array_values(pathinfo($absPath)); |
|
| 59 | + $pngPreview = $dirname.'/'.$filename.'.png'; |
|
| 60 | 60 | |
| 61 | - $png = new \imagick($pngPreview . '[0]'); |
|
| 61 | + $png = new \imagick($pngPreview.'[0]'); |
|
| 62 | 62 | $png->setImageFormat('jpg'); |
| 63 | 63 | } catch (\Exception $e) { |
| 64 | 64 | $this->cleanTmpFiles(); |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | |
| 47 | 47 | $content = stream_get_contents($file->fopen('r')); |
| 48 | 48 | if (substr($content, 0, 5) !== '<?xml') { |
| 49 | - $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . $content; |
|
| 49 | + $content = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'.$content; |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | // Do not parse SVG files with references |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $bp->setFormat('jpg'); |
| 60 | 60 | } catch (\Exception $e) { |
| 61 | 61 | \OC::$server->getLogger()->logException($e, [ |
| 62 | - 'message' => 'File: ' . $file->getPath() . ' Imagick says:', |
|
| 62 | + 'message' => 'File: '.$file->getPath().' Imagick says:', |
|
| 63 | 63 | 'level' => ILogger::ERROR, |
| 64 | 64 | 'app' => 'core', |
| 65 | 65 | ]); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $bp = new \Imagick(); |
| 94 | 94 | |
| 95 | 95 | // Layer 0 contains either the bitmap or a flat representation of all vector layers |
| 96 | - $bp->readImage($tmpPath . '[0]'); |
|
| 96 | + $bp->readImage($tmpPath.'[0]'); |
|
| 97 | 97 | |
| 98 | 98 | $bp->setImageFormat('jpg'); |
| 99 | 99 | |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | $bp = $this->getResizedPreview($tmpPath, $maxX, $maxY); |
| 50 | 50 | } catch (\Exception $e) { |
| 51 | 51 | \OC::$server->getLogger()->logException($e, [ |
| 52 | - 'message' => 'File: ' . $file->getPath() . ' Imagick says:', |
|
| 52 | + 'message' => 'File: '.$file->getPath().' Imagick says:', |
|
| 53 | 53 | 'level' => ILogger::ERROR, |
| 54 | 54 | 'app' => 'core', |
| 55 | 55 | ]); |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | $bp = new Imagick(); |
| 84 | 84 | |
| 85 | 85 | // Layer 0 contains either the bitmap or a flat representation of all vector layers |
| 86 | - $bp->readImage($tmpPath . '[0]'); |
|
| 86 | + $bp->readImage($tmpPath.'[0]'); |
|
| 87 | 87 | |
| 88 | 88 | $bp = $this->resize($bp, $maxX, $maxY); |
| 89 | 89 | |