Sure right now you have both input fields with name='img'
you need to change this, one of them needs a different name.
<div class="form-group">
<label for="inputPassword3" class="col-sm-2 control-label">Example</label>
<div class="col-sm-10">
<input type="file" class="form-control" name="img_example">
<?php if (!empty($template)) { ?>
<img src="/files/templates/example<?= $template['id'] ?>.jpg" width="100" class="thumbnail">
<?php } ?>
</div>
</div>
Then in your controller you need to store each of the images with the appropriate name. Might want to check to make sure they are set also:
if(isset($_FILES['img'])) {
$img = new Imagick($_FILES['img']['tmp_name']);
$img->setImageFormat('jpg');
$img->writeImages('files/templates/blank' . $id . '.jpg', true);
}
if(isset($_FILES['img_example'])) {
$img_example = new Imagick($_FILES['img_example']['tmp_name']);
$img_example->setImageFormat('jpg');
$img_example->writeImages('files/templates/example' . $id . '.jpg', true);
}
Obviously you would do something similar for the edit case and the delete case.