exec won't pass arg with spaces
| From: | Raul Millan | Date: | Fri, 30 Jan 2004 01:42:14 +0000 |
| Subject: | exec won't pass arg with spaces | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-176288@lists.php.net to get a copy of this message | ||
I'm trying to execute /usr/bin/convert passing the image size and the file name, the problem is that the file name contains lots of spaces, so I try to pass "filename with lots of spaces", and nothing works.
I've read something about safe mode, but I have safe mode disabled; I also read something about a bug, but nothing definitive. Can someone point me in the right direction?
Here's is my configuration:
Red Hat Linux 9
php-4.2.2-17.2
httpd-2.0.40-21.3
Sample code:
exec("$imagemagickPath/convert -geometry " .
"{$thumbnail_width}x{$thumbnail_height} " .
"$images_dir/$filename $images_dir/tb_$filename");
where filename could be:
/var/www/html/images/SPIN CoreRT1 to EX-JF1 (cw - kpi - KPI Performance Report(Weekly).png
What I'm trying to do is simply create thumbnails of images stored in a directory, there are thounsands of images.
I've tried to send the complete strings to a externa script that executes convert, but at the moment of exectution the " are removed and the scripts fails.
Here is a extract of the /var/log/httpd/error_log
convert: Unable to open file (/var/www/html/ivexport/spinkpi_offline/tb_SPIN - Core-Rt2 POS to ATL (cw - WAN Link Performance - 3 Daily).png).
I'm not very experienced with PHP, and it's been a coulpe of years since I coded.
Any help would be greatly appreciated.
Regards,
Raúl Millán