Here is a error in the PHP code when trying to import images. The scenario to reproduce the error is:

  1. Put in /tmp/image image files with invalid extension (in my case its was .bmp).
  2. Select these files for import.
  3. Execute import.

The result is:

Image import

    * warning: array_filter() [function.array-filter]: The first argument should be an array in /data/projects-sites/sites/all/modules/image/contrib/image_import/image_import.pages.inc on line 168.
    * warning: Invalid argument supplied for foreach() in /data/projects-sites/sites/all/modules/image/contrib/image_import/image_import.pages.inc on line 168.

Import multiple image files and save them as image nodes. The files will be moved from their location into the image module's files directory. Searching for image files in /data/projects-sites/tmp/image.

Ivan Cenov

Comments

jwalkerbg’s picture

Priority: Normal » Minor
mhhelle’s picture

Is this still a problem for you? I tried it with 6.x-1.x-dev as of today and could not reproduce with .jpg files that I renamed either with ".bmp" or ".xxx" extensions.

MatWho’s picture

Still a problem

Get :

warning: array_filter() expects parameter 1 to be array, null given in /var/vhosts/manydeeds/sites/all/modules/image/contrib/image_import/image_import.pages.inc on line 214.
warning: Invalid argument supplied for foreach() in /var/vhosts/manydeeds/sites/all/modules/image/contrib/image_import/image_import.pages.inc on line 214.
joachim’s picture

Status: Active » Postponed (maintainer needs more info)

Have you tried this with the current release rather than alpha 4?

joachim’s picture

Title: PHP error when trying to import invalid file types only. » import gives error message when no images selected
Version: 6.x-1.0-alpha4 » 6.x-1.x-dev
Status: Postponed (maintainer needs more info) » Active

> # Select these files for import.

Er... PEBKAC? ;)

I've just tried this, and you actually *can't* select a BMP file for import -- it says "Not a JPG, GIF or PNG file." in the table.

However, I do get the same error when no files are selected. We should probably add a form validation handler to check *something* is selected. But really, you shouldn't press 'Import' until you've selected something and nothing bad happens -- hence this is going to be low down on my priority list.

Perhaps this could be a good one for a newbie to try patching -- good introduction to FormAPI probably.