• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Selected image information deleted if to big..

rbuelund

Member
I have a form with repeated group. Each added group contains 3 fileupload elements with limit of 1,5 MB. The selected image information is removed if one of the images are to big upon upload - can this in any way be avoided, so that one not has to select all images all over if one is too big ? I know that Ajax could validate befor upload, but you have earlier told that ajax is not supported with repeat groups ?
 
I managed to create a javascript on each fileupload element that checks the size on change:

var fileUpload = document.querySelectorAll('[id^="nfo2fabrik_killinger_65_repeat___image_1"]');
[].forEach.call(fileUpload, function (e){
if (e.files !== null) {
if (e.value !== ''){
var size = parseFloat(e.files[0].size / 1024).toFixed(2);
if(size > 1499)
{
alert("The image you have selected is bigger thanbj 1500 KB ! Size is: " + size + " KB. Please select another image less than 1500 KB");
e.value = '';
}
}
}
});
 
Just made the script a little better. Now it also resets the preview image:

var maxsize = 1500;
var fileUpload = document.querySelectorAll('[id^="nfo2fabrik_killinger_65_repeat___image_1"]');
[].forEach.call(fileUpload, function (e){
if (e.files !== null) {
if (e.value !== ''){
var size = parseFloat(e.files[0].size / 1024).toFixed(2);
if(size > maxsize)
{
alert("The image you just selected is bigger than "+maxsize+" KB ! The size is: " + size + " KB. Please select another image that is smaller than "+maxsize+" KB");
alert(e.parentElement.className);
e.value = '';
var tempimage = e.parentElement.getElementsByTagName('img');
tempimage[0].src = "/";
var tempimagespan = e.parentElement.getElementsByTagName('span');
tempimagespan[0].classList.add("fabrikHide");
}
}
}
});
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top