Pictures open in a Picture window: the profile, Admin Users, contacts, assets, locations and racks show the picture itself on a button with a camera badge, a person's initials or an Add a photo box when there is none, and clicking it opens a window over the form to drop, paste or choose a picture, crop it to fit its shape by dragging, zooming and turning, and use it or remove the one there is; new pictureField in functions/picture.php and js/picture_field.js put the crop in a hidden file input as a JPG or WebP up to 512 pixels for a person or 2048 for a photo, upright and without location or camera details, and set the existing remove field, so the forms post the same fields and no handler changed; a person's initials follow the name as it is typed; the old file inputs, remove boxes and preview scripts on those forms are gone; 26.11.9 changelog entries

This commit is contained in:
johnnyq
2026-11-16 14:44:31 -05:00
parent 525e1b6f43
commit eee720ff77
12 changed files with 1007 additions and 157 deletions

View File

@@ -109,20 +109,9 @@ $form_id = 'locationForm' . ($location_form_mode === 'edit' ? $location_id : 'Ne
<div class="col-12">
<label class="form-label">Photo</label>
<div class="d-flex align-items-center gap-3">
<?php if ($location_photo) { ?>
<img class="itflow-asset-icon itflow-asset-icon-lg" src="<?= "../uploads/clients/$client_id/$location_photo" ?>" alt="">
<?php } ?>
<div class="flex-grow-1">
<input type="file" class="form-control" name="file" accept="image/*">
<?php if ($location_photo) { ?>
<div class="form-check mt-1">
<input class="form-check-input" type="checkbox" name="remove_photo" value="1" id="<?= $form_id ?>RemovePhoto">
<label class="form-check-label small" for="<?= $form_id ?>RemovePhoto">Remove the photo</label>
</div>
<?php } else { ?>
<div class="form-text">The front of the building - so a tech knows it when they pull up.</div>
<?php } ?>
</div>
<?= pictureField('file', $location_photo ? 'remove_photo' : '', $location_photo ? picturePhoto('../uploads/clients/' . intval($client_id) . '/' . html_entity_decode($location_photo), 'Photo') : picturePhotoEmpty(), picturePhotoEmpty(),
['shapes' => 'square,4:3,whole']) ?>
<div class="form-text mt-0">The front of the building - so a tech knows it when they pull up. Click it to add a photo or change it.</div>
</div>
</div>
</div>