Re: exec won't pass arg with spaces

From: Date: Fri, 30 Jan 2004 02:24:41 +0000
Subject: Re: exec won't pass arg with spaces
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176290@lists.php.net to get a copy of this message
>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 More quotes! :) The shell delimits tokens with whitespace, so you'd need to escape that whitespace, or quote it, like so (untested): exec(sprintf('%s/concert -geometry %dx%d "%s/%s" "%s/tb_%s"', $imagemagickPath, $thumbnail_width, $thumbnail_height, $images_dir, $filename, $images_dir, $filename)); Note the extra quotes around the two filepaths. --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html

« previous php.general (#176290) next »