Jump to content

[Solved] Problem with uploading PNG Image files


Remi
 Share

Recommended Posts

Hi!

I've had a problem with uploading PNG files into Image field. I've had an error:

Error: Uncaught Error: Call to undefined function ProcessWire\utf8_encode() in /var/www/domain.com/public_html/wire/core/PWPNG.php:117 Stack trace: #0
/var/www/dksb.turala.com/public_html/wire/core/PWPNG.php(31): ProcessWire\PWPNG->_parsepngstream(Resource id #155, 'image.260x...') #1
/var/www/dksb.turala.com/public_html/wire/core/ImageInspector.php(203): ProcessWire\PWPNG->loadFile('/var/www/domain...') #2
/var/www/dksb.turala.com/public_html/wire/core/ImageInspector.php(129): ProcessWire\ImageInspector->loadImageInfoPng() #3
/var/www/dksb.turala.com/public_html/wire/core/ImageSizer.php(102): ProcessWire\ImageInspector->inspect('/var/www/domain...', true) #4
/var/www/dksb.turala.com/public_html/wire/core/Pageimage.php(479): ProcessWire\ImageSizer->__construct('/var/www/domain...', Array) #5
/var/www/dksb.turala.com/public_html/wire/core/Pageimage.php(346): ProcessWire\Pageimage->___size(260, 0, Array) #6
/var/www/dksb.turala.com/public_html/wire/core/Pageimage.php(632): ProcessWire\Pageimage->size(260, 0, (line 117 of
/var/www/dksb.turala.com/public_html/wire/core/PWPNG.php)

In this case I've had to install PHP-XML library for PHP-FPM deamon.

On CentOS 7 it's:

yum install php-xml

And after that I've had to restart PHP-FPM deamon:
 

systemctl restart php-fpm

I hope this solution will help others with the same problem.

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...

Just had a similar problem after switching from PHP5.x to a PHP7.1.x system. Fatal error in admin (line 117 of /wire/core/PWPNG.php) while rebuilding a PNG thumbnail.

Obviously, utf8_encode() is not necessarily part of core PHP functions (anymore). I fixed the problem by asking my server admin to install the missing PHP XML module.

Though, I wonder if it would be a worth the effort to avoid use of utf8_encode() in the PW core altogether? It seems to be used rarely - I found two places only in V3.0.123. Would iconv() do the job?

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...