Running from command line using PHP
Running from command line using PHP
I've used phpthumb() for my thumbnail creations, but I decided to use only simple exec() command to covert images due to speed reasons. Everything works well but everytime I run exec(), php runs command line tool and black windows appears for a while. How can I get rid of this window? When using phpthumb(), it wasn't shown but I wasn't able to find it in source codes. Thanks for your help
Re: Running from command line using PHP
That does not happen to me with php; what code are you using?
Also a lot of php and ImageMagick examples on my site.
Also a lot of php and ImageMagick examples on my site.
Re: Running from command line using PHP
Dynamically generated from upload script:
ImageMagick\convert.exe upload/qnusup8mzv/s57h2lfa4r.jpg -write mpr:image +delete \( mpr:image -thumbnail 480 -write upload/qnusup8mzv/s57h2lfa4r_480.jpg \) ( mpr:image -thumbnail 250 -write upload/qnusup8mzv/s57h2lfa4r_250.jpg \) ( mpr:image -thumbnail 100 -write upload/qnusup8mzv/s57h2lfa4r_100.jpg \) ( mpr:image -thumbnail 64x64! -write upload/qnusup8mzv/s57h2lfa4r_64.jpg \)
This is in variable which is parameter of exec function.
This is quite fast for me, but is there any way how to speeden it up? when it is in MPR, does it need to be cleared or MPR is cleared automatically?
I am quite new to this, but this works.
Moreover, what is faster? Exec(or passthru, system) or using MagickWand or Imagick?
ImageMagick\convert.exe upload/qnusup8mzv/s57h2lfa4r.jpg -write mpr:image +delete \( mpr:image -thumbnail 480 -write upload/qnusup8mzv/s57h2lfa4r_480.jpg \) ( mpr:image -thumbnail 250 -write upload/qnusup8mzv/s57h2lfa4r_250.jpg \) ( mpr:image -thumbnail 100 -write upload/qnusup8mzv/s57h2lfa4r_100.jpg \) ( mpr:image -thumbnail 64x64! -write upload/qnusup8mzv/s57h2lfa4r_64.jpg \)
This is in variable which is parameter of exec function.
This is quite fast for me, but is there any way how to speeden it up? when it is in MPR, does it need to be cleared or MPR is cleared automatically?
I am quite new to this, but this works.
Moreover, what is faster? Exec(or passthru, system) or using MagickWand or Imagick?
Re: Running from command line using PHP
What happens if you use this:
Using Imagick or Magickwand should be fatser, exec and system are the same - system displays some results but exec does not. No idea about passthru
Code: Select all
exec("convert upload/qnusup8mzv/s57h2lfa4r.jpg \( +clone -thumbnail 480 -write upload/qnusup8mzv/s57h2lfa4r_480.jpg +delete \) ( +clone -thumbnail 250 -write upload/qnusup8mzv/s57h2lfa4r_250.jpg +delete \) ( +clone -thumbnail 100 -write upload/qnusup8mzv/s57h2lfa4r_100.jpg +delete \) -thumbnail 64x64! upload/qnusup8mzv/s57h2lfa4r_64.jpg ");
Re: Running from command line using PHP
When I start with convert only, it doesn't find appropriate convert.exe. I don't know how to set up PHP(probably) to work with it, maybe I should copy convert.exe to directory where executed script is... maybe? Are you sure using those libraries is faster? I need it to have that thumbnail query to be maximally optimized:P
Re: Running from command line using PHP
I've made it work only with convert, but it still shows DOS dialog window with address C:\Windows\system32\cmd.exe and closes after execution.Bonzo wrote:What happens if you use this:Using Imagick or Magickwand should be fatser, exec and system are the same - system displays some results but exec does not. No idea about passthruCode: Select all
exec("convert upload/qnusup8mzv/s57h2lfa4r.jpg \( +clone -thumbnail 480 -write upload/qnusup8mzv/s57h2lfa4r_480.jpg +delete \) ( +clone -thumbnail 250 -write upload/qnusup8mzv/s57h2lfa4r_250.jpg +delete \) ( +clone -thumbnail 100 -write upload/qnusup8mzv/s57h2lfa4r_100.jpg +delete \) -thumbnail 64x64! upload/qnusup8mzv/s57h2lfa4r_64.jpg ");
Is it possible to pass into Imagick full convert query?