note 37458 added to function.proc-open
| From: | AlexanderWigenwww dot wigen dot net at rn2 dot php dot net | Date: | Sun, 16 Nov 2003 00:35:04 +0000 |
| Subject: | note 37458 added to function.proc-open | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-60443@lists.php.net to get a copy of this message | ||
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?
----
Manual Page -- http://www.php.net/manual/en/function.proc-open.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37458
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37458&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37458&report=yes
Search -- http://master.php.net/manage/user-notes.php