<?php
if (!empty($values[$custom_field_data['database_field']])) {
    ?>
    <img src="<?=SITE_URL;?>/<?=$custom_folders['normal']['path'];?>/<?=clean_page($values[$custom_field_data['database_field']]);?>" />
    </div>
    <input type="hidden"
           name="custom[<?=clean_page($custom_field_data['database_field']) ?>]"
           value="<?= clean_page($values[$custom_field_data['database_field']]) ?>"/>
    <div class="row">
        <label>Delete Image</label>
        <input type="checkbox"
                name="delete_image[<?= clean_page($custom_field_data['database_field']) ?>]"
                />
    </div>
    <div class="row">
        <label>Upload new</label>
        <input type="file"
                name="custom[<?= clean_page($custom_field_data['database_field']) ?>]"
                value="<?= clean_page($values[$custom_field_data['database_field']]) ?>"
                />

<?php
} else {
    ?>
    <input type="file"
            name="custom[<?= clean_page($custom_field_data['database_field']) ?>]"
            value="<?= clean_page($values[$custom_field_data['database_field']]) ?>"
            />
<?php
}
