Magento 1.7 Import – Fix ‘Invalid Image File Type’ Error

imageimportimportexportmagento-1.7product-images

For the past couple year we've uploaded our configurable product images to the parent product. We're implementing some new procedures that require specific images to be uploaded to each child product as well.

I'm using a bulk import to associate these images with their respective child products. All images have been placed in the /media/import folder, and the import sheet has been configured with the images listed under the "image" column, formatted as /image-filename.jpg

Upon attempting to upload the file and import the images, Magento gives me an error for each entry claiming "Invalid image file type." The research I've done so far only elaborates as far as saying that Magento only accepts 'jpg', 'jpeg', 'gif', and 'png' image types, but of course all my images are '.jpg'

Any ideas why Magento wouldn't like my .jpg's?

Best Answer

You can put a var_dump in app/code/core/Mage/Catalog/Model/Product/Attribute/Backend/Media.php around line 280 and see what do you have inside $pathinfo. Code is quite clear, it seems to check the extension of the file you are uploading only.

    $pathinfo = pathinfo($file);
    $imgExtensions = array('jpg','jpeg','gif','png');
    if (!isset($pathinfo['extension']) || !in_array(strtolower($pathinfo['extension']), $imgExtensions)) {
        Mage::throwException(Mage::helper('catalog')->__('Invalid image file type.'));
    }