ImageMagick: Unterschied zwischen den Versionen
Aus Wikizone
(Die Seite wurde neu angelegt: „== ImageMagick Snippets == === Wo ist ImageMagick installiert === <syntaxhighlight lang="php"> <?php // where is imageMagick ? echo "<pre>"; system("type conve…“) |
|||
| Zeile 1: | Zeile 1: | ||
| + | Links | ||
| + | |||
| + | * http://www.rubblewebs.co.uk/imagemagick/imagemagick.php | ||
== ImageMagick Snippets == | == ImageMagick Snippets == | ||
| + | |||
=== Wo ist ImageMagick installiert === | === Wo ist ImageMagick installiert === | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
| Zeile 8: | Zeile 12: | ||
echo "</pre>"; | echo "</pre>"; | ||
?> | ?> | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | oder | ||
| + | <syntaxhighlight lang="php"> | ||
| + | echo "<pre>"; | ||
| + | system(\'which convert\',$path); print_r($path); | ||
| + | echo "</pre>"; | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | ===Portable method=== | ||
| + | Quelle: http://www.rubblewebs.co.uk/imagemagick/server/command.php (2017-10) | ||
| + | |||
| + | To make the code more portable you can use this to get the path to convert from the server and automaticaly put it into your code. | ||
| + | |||
| + | |||
| + | <syntaxhighlight lang="php"> | ||
| + | // In my case $HTTP_ENV_VARS[\'PATH\'] = bin:usr/bin | ||
| + | $env_vars = explode( \':\', $HTTP_ENV_VARS[\'PATH\']); | ||
| + | // Combine the required part from $HTTP_ENV_VARS[\'PATH\'] and convert for your path. | ||
| + | $env_path = $env_vars[1]."/convert"; | ||
| + | // Now $env_path = usr/bin/convert | ||
| + | // Usage: | ||
| + | exec("$env_path image.jpg -resize 100x100 output.jpg"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Aktuelle Version vom 10. Oktober 2017, 10:45 Uhr
Links
ImageMagick Snippets[Bearbeiten]
Wo ist ImageMagick installiert[Bearbeiten]
<?php
// where is imageMagick ?
echo "<pre>";
system("type convert");
echo "</pre>";
?>
oder
echo "<pre>";
system(\'which convert\',$path); print_r($path);
echo "</pre>";
Portable method[Bearbeiten]
Quelle: http://www.rubblewebs.co.uk/imagemagick/server/command.php (2017-10)
To make the code more portable you can use this to get the path to convert from the server and automaticaly put it into your code.
// In my case $HTTP_ENV_VARS[\'PATH\'] = bin:usr/bin
$env_vars = explode( \':\', $HTTP_ENV_VARS[\'PATH\']);
// Combine the required part from $HTTP_ENV_VARS[\'PATH\'] and convert for your path.
$env_path = $env_vars[1]."/convert";
// Now $env_path = usr/bin/convert
// Usage:
exec("$env_path image.jpg -resize 100x100 output.jpg");