Quite an unusual question, I admit. The crux of the matter is my utilization of a fantastic tool known as cropit. With this tool, we have the ability to upload an image, preview it, and then manipulate it according to our preferences.
HTML:
<div align="center" id="image-cropper1">
<!-- This is where users can select a new image -->
<label class="btn btn-success btn-file">Upload Photo<input type="file" class="cropit-image-input"/></label><br><br>
<!-- This is where the preview image will be displayed -->
<label><div class="cropit-preview"><img class="prepic" src="preloadimage.jpg"></label>
<!-- Here is how you can process the image -->
<button type="button" id="image1pick" class="btn btn-primary" data-dismiss="modal" disabled>OK</button></div>
JQuery:
$('#image-cropper1').cropit();
$('#image-cropper1').change(function() {
$('#image1pick').prop('disabled', false);
});
$('#image1pick').click(function() {
imageData1 = $('#image-cropper1').cropit('export', {originalSize: true});
$.post('somephp.php', { imageData1: imageData1 }, function() { $('#image1pick').data('clicked', true) })
});
My goal now is to integrate another <input type="file"/>
button that enables the uploading of 6 images simultaneously and displays them in 6 separate ".cropit-preview"
divs. This is crucial because users can zoom in and rotate the images within the previews. Is there a way to achieve this with multiple files while still adhering to the structure of this tool?
EDIT:
Please refer to the documentation: The issue lies in the structure. Let's say I need three different croppers. The layout would appear as follows:
JQuery:
$('#image-cropper1').cropit();
$('#image-cropper2').cropit();
$('#image-cropper3').cropit();
HTML:
<!-- Cropper No 1 -->
<div id="image-cropper1">
<input type="file" class="cropit-image-input" />
<div class="cropit-preview"></div>
</div>
<!-- Cropper No 2 -->
<div id="image-cropper2">
<input type="file" class="cropit-image-input" />
<div class="cropit-preview"></div>
</div>
<!-- Cropper No 3 -->
<div id="image-cropper3">
<input type="file" class="cropit-image-input" />
<div class="cropit-preview"></div>
</div>
As shown above, each file input and preview div are contained within their respective numbered divs. However, I now aim to introduce one input option that can upload three images at once and correspondingly fit into every image-preview displayed within each numbered div. How can this objective be accomplished?