note 37458 deleted from function.proc-open by didou
| From: | didou@php.net | Date: | Thu, 19 Feb 2004 17:27:44 +0000 |
| Subject: | note 37458 deleted from function.proc-open by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65409@lists.php.net to get a copy of this message | ||
Note Submitter: Alexander Wigen www.wigen.net
----
I use this sniplet to generate thumbnails for an image I have in the var $img
$dspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("file", "/tmp/eo.txt", "a"));
$process = proc_open("convert - -resize 200x300 -", $dspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0], $img);
fclose($pipes[0]);
while(!feof($pipes[1]))
$thumbdata .= fgets($pipes[1], 1024);
fclose($pipes[1]);
proc_close($process);
}else {
echo "Failed to open pipe to convert!\n";
}
Now there is a thumbnail of max 200x300 pixels in $thumbdata
Maby someone could comment on dspec[2], maby that should just be a pipe and could be ignored?