Skip to content

Commit

Permalink
added readme
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidPetrasek committed Jun 12, 2024
1 parent dabcf31 commit 85faf3d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Installation

`composer require psys/symfony-utils`


## Add this to services.yaml:

```
Psys\SymfonyUtils\FormErrors:
autowire: true
Psys\SymfonyUtils\FileUploader:
autowire: true
```

8 changes: 4 additions & 4 deletions src/FileUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function stripMetadata ($fileAbsPath, $mimeType, $extension)
// $pages = (int)$imagick->getNumberImages();

// Save all pages as temporary JPGs
$absCestyTemp = [];
$absPathsTemp = [];
foreach ($imagick as $i => $im)
{ //
$im->setImageFormat('jpeg');
Expand All @@ -116,21 +116,21 @@ private function stripMetadata ($fileAbsPath, $mimeType, $extension)
}

$im->writeImage($absPath);
$absCestyTemp[] = $absPath;
$absPathsTemp[] = $absPath;
}
//
$imagick->clear();

// New PDF from temporary JPGs
$imagick = new \Imagick($absCestyTemp);
$imagick = new \Imagick($absPathsTemp);
$imagick->setImageFormat('pdf');
$imagick->writeImages($fileAbsPath, true);
$imagick->clear();

// Remove temporary JPGs
try
{
$this->filesystem->remove($absCestyTemp);
$this->filesystem->remove($absPathsTemp);
}
catch (IOExceptionInterface $exception)
{
Expand Down

0 comments on commit 85faf3d

Please sign in to comment.