Undefined property in fileupload.php

Slater

New Member
I've just updated from 3.7 to 3.81

Since the update I am getting an error similar to one previously reported here..
http://fabrikar.com/forums/index.php?threads/error-fileupload-element-when-upload-image-1mb.47472/


When uploading images from a mobile phone using the image capture I get the following errors on form submission

NOTICE: Undefined property: stdClass::$shop___id_raw in /home/svr/public_html/plugins/fabrik_element/fileupload/fileupload.php on line 1684

followed by

Fatal error: Class Fabrik\Helpers\Image\StringHelper' not found in /home/svr/public_html/libraries/fabrik/fabrik/Helpers/Image/Imagegd.php on line 101

I've had to restore the backup to get the site working again..

The error is not present when using desktop browsers, only on the mobile devices - requesting a desktop site from the mobile has made no difference.
 
Why are you using the GD image lib rather than GD2? What version of PHP are you running?

GD (v1) is an ancient version of the PHP image processing library, which was deprecated and support removed in 2010, in favor of GD2:

https://wiki.php.net/rfc/removal-of-deprecated-features

Check your file upload settings, under Display, Image Lib, see if you have a version of GD which says something like "GD: bundled (2.x.x compatible)", and if so, select that.

If not, then you really need to update your PHP.

-- hugh
 
Seems I'm already using GD Bundled (2.1.0 compatible) - its the only option available in the Display,Image Lib

Any other ideas ?
 
Ah HAH!

I see the problem, and why it would be specific to mobile phones, with EXIF data in the image. If you have "WIP" (work in progress) enabled, we check the embedded EXIF data in the uploaded image, and attempt to rotate the image if necessary. Which winds up calling a (broken) function from the GD lib, rather than the GD2 lib.

Try editing:

./libraries/fabrik/fabrik/Helpers/Image/Imagegd.php

... and at line 14, add this:

Code:
use \Fabrik\Helpers\StringHelper;

I think that'll fix it. Let me know. If it does, I'll commit the change to github.

-- hugh
 
Thanks for the update...

I'll need to plan an update on our site, but just a note - I did not have work in progress turned on.
 
Hi,

I had the same issue, but add "use \Fabrik\Helpers\StringHelper;" wasn't enough in my case.

Fileupload was working on Android (6.0.1) and on a desktop, but on an iphone (tested with iPhone 4 / 6) I had a 'Class 'Fabrik\Helpers\Image\StringHelper' not found', with no indication of the file where the problem was.

I added the line "use \Fabrik\Helpers\StringHelper;" in ./libraries/fabrik/fabrik/Helpers/Image/Imagegd.php

After that I've had a new error: Class 'Fabrik\Helpers\Image\JFile' not found

So I added: use JFile;

After that I've had a new error: Class 'Fabrik\Helpers\Image\JFactory' not found

So I added: use JFactory;

And now it works again on iPhone

Weird :) why iPhone only? someone else experiment the same problem?
 
Hi Hugh,

Previously it was working well with both android an iphone, I don't know when the problem began with iphone.
With the 2 'use' I add it works again but could you put it in the next version?
 
I've committed some changes to imagegd.php which should fix it.

I'm still puzzled as to why Android doesn't trigger this, unless you have your Android phone configured not to include EXIF data in the uploads.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top