Variables in the code


<?php
$size = getimagesize('sunflower.jpg');

// You can also use ' or \" instead of { }
exec("convert -size {$size[0]}x{$size[1]} input_image.jpg -resize 100x100 output_image.jpg");

// If you have a long path I find it easier to put the path into a variable.
$input_image = "folder1/folder2/input_image_12345.jpg";
exec("convert $input_image output_image.jpg");
?>

A couple of methods of using variables in the code