I've inherited a site built with Drupal, moved it to a different server (from Ubuntu Server 9.10 to Ubuntu Server 10.04) and now I'm geting the following error when I trying to upload an image via an ImageField.
„160284.jpg” nem tölthető fel. The file is not a known image format.
The first (localized) part of the error is „160284.jpg” cannot be uploaded."
I've noticed that the second part of the error is not true. It is generated in filefield_validate_is_imag开发者_StackOverflowe() and is caused by the file referenced in $file->filepath missing.
File permissions shouldn't be a problem because right now everything is just 777. The temp directory is writable too.
What is causing the error?
The problem could be rooted in PHP needing some image library or you didn't activate needed image API modules to handle it.
Solved a few days ago. The culprit was a missing fileinfo module. Seems to work fine after installing it.
pecl install fileinfo
You probably don't have libjpeg.so
installed, or don't have PHP compiled with support for GD. Confusingly, the errors that Drupal passes along don't give any hint that this is probably a PHP issue unrelated to Drupal.
If you have Devel installed, go to devel/phpinfo
and check the "JPG Support" line under the "gd" heading.
If GD is supported but there's no JPG support, recompile PHP with --with-jpeg-dir=/usr/lib
or check the manual for your OS and PHP version. If you're on a shared host, you may need to open a ticket for tech support, asking them to add GD JPEG support for PHP.
Similarly, if there's no "gd" heading under devel/phpinfo
, you'll need to recompile PHP with '--with-gd', or open a ticket with tech support on a shared host, etc.
The folks over at www.serverfault.com can help you if you have any trouble getting GD support to work right, but it's usually straightforward.
If you have the problem on Apache, It can be than your drupal tmp folder is not the same than the php one. Check http://drupal.org/node/1224998#comment-4762636
精彩评论