Page 1 of 1
Running from command line using PHP
Posted: 2008-04-26T05:40:54-07:00
by JAM3SoN
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
Posted: 2008-04-26T05:57:42-07:00
by Bonzo
That does not happen to me with php; what code are you using?
Also a lot of php and ImageMagick examples on my site.
Re: Running from command line using PHP
Posted: 2008-04-26T06:16:23-07:00
by JAM3SoN
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?
Re: Running from command line using PHP
Posted: 2008-04-26T08:23:28-07:00
by Bonzo
What happens if you use this:
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 ");
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
Re: Running from command line using PHP
Posted: 2008-04-26T09:42:09-07:00
by JAM3SoN
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
Posted: 2008-04-26T13:37:20-07:00
by JAM3SoN
Bonzo wrote:What happens if you use this:
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 ");
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
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.
Is it possible to pass into Imagick full convert query?