Hello. Is there a better way for my members to upload a photo gallery? I have a website that will be used to publish properties, the members will be real estate brokers, I have created a form that has a part to upload a photo gallery of the property, limited to 10 images per property (in the upload button), I used the method from this linkand addap it because I didn’t find anything better to preview multiple photos from a gallery, the problems are (in plural) that:
1.- Regardless of the order in which the photos are selected, they are rearranged in alphabetical order, preventing the member from choosing the order to display her photos.
2.- In another form that allows you to edit a property, all the fields are efficiently overwritten, but, in the case of the gallery, the images are not overwritten but added. Can it be solved with code?
3.- If by mistake they included 1 image that should not go, they cannot delete it, but click again on the button to select all the images and this time choose correctly, I noticed that under the selection button there is the option to remove certain image before uploading, but without a visual preview
By at least fixing problem 2, I could expect my future members to be understanding of problems 1 and 3, but problem 2 will not only run out of hosting space in a matter of weeks, my members also don’t have 10 photos, but with an “infinite” number of which many will have been unwanted by them in the galleries of their properties, I leave here the code I used in case someone likes to use it or finds it useful.
Thanks in advance
export function buttonGal_click(event) {
if ($w("#uploadButtonGal").value.length > 0) {
$w("#uploadTextGal").text = "Cargando " + $w("#uploadButtonGal").value[0].name;
$w("#uploadButtonGal").uploadFiles()
.then((uploadedFiles) => {
$w("#uploadTextGal").text = "Carga exitosa!";
$w("#gal1").src = uploadedFiles[0].fileUrl;
$w("#gal2").src = uploadedFiles[1].fileUrl;
$w("#gal3").src = uploadedFiles[2].fileUrl;
$w("#gal4").src = uploadedFiles[3].fileUrl;
$w("#gal5").src = uploadedFiles[4].fileUrl;
$w("#gal6").src = uploadedFiles[5].fileUrl;
$w("#gal7").src = uploadedFiles[6].fileUrl;
$w("#gal8").src = uploadedFiles[7].fileUrl;
$w("#gal9").src = uploadedFiles[8].fileUrl;
$w("#gal10").src = uploadedFiles[9].fileUrl;
})
.catch((uploadError) => {
$w("#uploadTextGal").text = "Error en la carga";
console.log("File upload error: " + uploadError.errorCode);
console.log(uploadError.errorDescription);
});
} else {
$w("#uploadTextReady").text = "Por favor, elige imágenes";
}
}
By the way, can someone recommend another type of gallery? any app? Any better method for members to upload their photos in a friendlier interface? I did the best I could with what I found, although I don’t know if there are more that I don’t know about. Thanks