Page 1 of 1
Confused with PHP
Posted: 2015-10-01T05:31:05-07:00
by marky
Sorry but I'm new to all of this!
Using Powershell I can find if PDF pages have colour using:
$colour = convert "$PDF" -colorspace HSL -channel G -separate -format %[fx:mean] info:
echo $colour
0 = B/W
>0 = colour
All is well.
I want to do this on my hosted website using PHP but don't know how!
Thanks in advance.
Re: Confused with PHP
Posted: 2015-10-01T05:36:07-07:00
by snibgo
I don't do PHP, but the IM PHP forum
viewforum.php?f=10 has plenty of examples to get you started. The "exec()" method seems to be easiest.
Re: Confused with PHP
Posted: 2015-10-01T05:57:18-07:00
by marky
Thank you. To get a clearer idea I am using
exec('/usr/bin/convert "logo1.bmp" -colorspace HSL -channel G -separate -thumbnail 200x200 -format %[fx:mean] info: ');
I cannot get the 'info' bit returned. I have already looked through the area you mentioned but could not find anything?
Re: Confused with PHP
Posted: 2015-10-01T06:17:57-07:00
by marky
Ok, got it!
exec('/usr/bin/convert "logogrey.bmp" -colorspace HSL -channel G -separate -format %[fx:mean] info:',$return_info );
echo $return_info[0];
It was the [0] bit as it;s an array being returned.
Re: Confused with PHP
Posted: 2015-10-01T12:48:01-07:00
by Bonzo
An alternate method:
Code: Select all
$colour = exec('/usr/bin/convert "logogrey.bmp" -colorspace HSL -channel G -separate -format %[fx:mean] info:' );