File tree Expand file tree Collapse file tree 4 files changed +10
-20
lines changed
Expand file tree Collapse file tree 4 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -18,13 +18,10 @@ jobs:
1818 steps :
1919 - uses : actions/checkout@v2
2020
21- - name : Install ImageMagick dependencies
21+ - name : Install ImageMagick
2222 run : |
2323 sudo apt-get update
2424 sudo apt-get upgrade -y libjpeg-dev libpng-dev libgif-dev make wget
25-
26- - name : Install ImageMagick
27- run : |
2825 wget https://www.imagemagick.org/download/ImageMagick.tar.gz
2926 tar xvzf ImageMagick.tar.gz
3027 cd ImageMagick-*
5148
5249 - run : composer install
5350
54- - run : vendor/bin/phpunit
51+ - run : |
52+ # export IMAGEMAGICK_PATH="docker run --rm --volume `pwd`:`pwd` --workdir=`pwd` --entrypoint="`pwd`/docker_entrypoint.sh" --user=$UID:$GID dpokidov/imagemagick:latest magick"
53+ vendor/bin/phpunit
Original file line number Diff line number Diff line change 2727
2828// Check if ImageMagick is installed. Instead, we cannot run tests suite.
2929$ possibleDirectories = [
30+ getenv ('IMAGEMAGICK_PATH ' ) ?: null ,
3031 null ,// In the PATH variable, default behavior
3132 '/usr/bin/magick ' ,
3233 '/usr/local/bin/magick ' ,
33- getenv ('IMAGEMAGICK_PATH ' ) ?: null , // Fall back again to PATH
3434];
3535foreach ($ possibleDirectories as $ path ) {
36- echo 'Check " ' .$ path .' " binary ' . "\n" ;
36+ echo 'Check for ImageMagick with path " ' .$ path ."\ "\n" ;
3737 try {
3838 $ path = Command::findMagickBinaryPath ($ path );
3939 exec ($ path .' -version ' , $ o , $ code );
4242 break ;
4343 }
4444 } catch (MagickBinaryNotFoundException $ e ) {
45+ echo 'Did not find ImageMagick with path " ' .$ path .'". ' .$ e ->getMessage ()."\n" ;
4546 }
4647}
4748
5354 );
5455}
5556
56- echo 'Analyzed ImageMagick directory: ' .IMAGEMAGICK_DIR ."\n" ;
57+ echo 'ImageMagick resolved to: " ' .IMAGEMAGICK_DIR ."\ "\n" ;
5758system (IMAGEMAGICK_DIR .' -version ' );
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ public function __construct(?string $magickBinaryPath = '')
8080 {
8181 $ magickBinaryPath = self ::findMagickBinaryPath ($ magickBinaryPath );
8282
83- $ process = new Process ([ $ magickBinaryPath, ' -version '] );
83+ $ process = Process:: fromShellCommandline ( $ magickBinaryPath. ' -version ' );
8484
8585 try {
8686 $ code = $ process ->run ();
@@ -115,16 +115,6 @@ public static function findMagickBinaryPath(?string $magickBinaryPath): string
115115 throw new MagickBinaryNotFoundException ((string ) $ magickBinaryPath );
116116 }
117117
118- // Add a proper directory separator at the end if path is not empty.
119- // If it's empty, then it's set in the global path.
120- if (!\is_file ($ magickBinaryPath )) {
121- throw new MagickBinaryNotFoundException ($ magickBinaryPath );
122- }
123-
124- if (!\is_executable ($ magickBinaryPath )) {
125- throw new \InvalidArgumentException (\sprintf ('The specified script (%s) is not executable. ' , $ magickBinaryPath ));
126- }
127-
128118 return $ magickBinaryPath ;
129119 }
130120
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class MagickBinaryNotFoundException extends Exception
2020 public function __construct (string $ magickBinaryPath )
2121 {
2222 parent ::__construct (\sprintf (
23- 'The specified path (%s ) is not a file. ' ."\n" .
23+ 'The specified path ("%s" ) is not a file. ' ."\n" .
2424 'You must set the "magickBinaryPath" parameter as the main "magick" binary installed by ImageMagick. ' ,
2525 $ magickBinaryPath
2626 ));
You can’t perform that action at this time.
0 commit comments