M
M
muhasa2019-06-30 23:30:16
PHP
muhasa, 2019-06-30 23:30:16

How to repeat command from console inside php?

Hello.
People, question. Yesterday in the console with the command

for file in *
do
        name=$(echo "$file" | cut -f 1 -d '.').png
  convert $file -fuzz 17% -transparent white "/new/$name"
done

successfully removed the background from some photos. Or, more precisely, replaced it with a transparent one.
B here is the question - obviously it can be done without using the command line. Just at the Imagick module level. Or not?
If possible, please tell me how. Googled, non-working options flew out there.
Or maybe there is no difference at all?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Baskakov, 2019-07-01
@dmitrybascacov

You can use unlink
https://www.php.net/manual/en/function.unlink.php
You can use `string to execute` to execute the string as a command line
https://www.php.net/manual/en/language .operators.e...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question