ImageMagick

Aus Wikizone
Wechseln zu: Navigation, Suche

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");