Joomla 5 - File upload element problems

Trembowiecki

Active Member
Hi, it's a little embarassing, but I've been using Fabrik for years now... just not the file upload element. Now I have to upload image (just one per form), crop it and save it, so I can generate PDF with cropped photo. And this is where I start to struggle, because:
1) when I save and re-open the form, I can't see any thumbnails (yes, I enabled thumbnails). I have to click this little Icon, so in popup I can see again original image with cropping area. I've tried various combinations and nothing - no preview thumb,
2) I thought that maybe I'll be clever and display thumb with a help of calc emelemnt, but... var_dump shows me looong string, which looks like JSON, but in square parentheses. Sure, I can remove parentheses, decode JSON and work with the part where file name is, but... isn't it an overkill? I mean - there must be a better way to just get the name of uploaded image, right?
3) my error log fills pretty quick with entries:

INI:
is_file(): open_basedir restriction in effect . File(/images/stories/image_name.jpg) is not within the allowed path(s)
And it doesn't matter whether I change 'Include server path' setting - I still get these warnings.

Also, when the popup opens and I drag the cropping area, I immediately get this error in console: Uncaught TypeError: Cannot read properties of undefined (reading 'contains').
 
Joomla 5.0.2, Fabrik 4 Zeta.

EDIT: Just checked my Joomla 4.4.2 installation - it's exactly the same.

I enslose 3 screenshots:

screen1.jpg - this is what I see when I upload image, save changes and reopen form (no preview thumbnail). When I click on the 4-arrow icon, I get...
screen2.jpg - the original image with cropping area. Still no errors in console. But when I click inside this popup, I see error (screen3.jpg).
 

Attachments

  • screen1.jpg
    screen1.jpg
    16.9 KB · Views: 39
  • screen2.jpg
    screen2.jpg
    73.1 KB · Views: 40
  • screen3.jpg
    screen3.jpg
    45.7 KB · Views: 41
Last edited:
To 1) This is how ajax fileupload is working (also in F3). In form view it doesn't show image/thumb/crop, only the icon in the list of uploaded files. The images are shown in list and details views.
It's only the non-ajax fileupload showing the image in form view.

In the PDF the cropped images are generated correctly on my site, what is your issue with PDFs?

The JS error is replicatable but it doesn't seem to hurt anything.

The open_basedir error message is not Fabrik related, this must be solved on your server (but if this issue prevents file access this will break image display).

File informations of an ajax fileupload element are in an additional DB table your-parent-table_repeat_fileupload_ajax with the clear filename in column `fileupload_ajax` and crop infos etc in `params`.

If you set max files =1 in ajax uploads it's working identically but doesn't create a child table.
The file informations are in your parent table. Format like
Code:
[{"file":"\\images\\stories\\your-image.jpg","params":"{\"rotation\":105,\"scale\":40,\"imagedim\":{\"x\":31.999999999999943,\"y\":266,\"w\":568.4,\"h\":757.6},\"cropdim\":{\"x\":200,\"y\":200,\"w\":200,\"h\":100},\"crop\":true,\"modalId\":\"fileupload-modal-testj5neu___fileupload_ajaxmax1-widget-mocha\",\"quality\":0.9,\"mainimagedim\":{\"x\":63,\"y\":263,\"w\":1421,\"h\":1894}}"}]
, inside [] it's JSON. So it should be complicated to extract the filename if needed.
 
Last edited:
Thank you for clearing things up for me. I've created workaround, which previews cropped image correctly. Regarding PDF - no issues here, I finally got to all the data I need (I needed clean path to cropped image, but earlier mentioned workaround fixed this). I just wanted to be sure that the fileupload behaviour is normal (no experience here so far). Once again - thank you!
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top