CSV product import failing on 1.0.3



  • I get the following when importing a product csv file:

    0_1503101428532_prntscn.jpg



  • On further investigation I found that it has something to do with the imagemagick module. When I tried to reverse the sort direction of the products in the back office it returned a 500 server error. I decrypted the error and it started with

    ThirtyBeesException

    **Premature end of JPEG file store/img/p/4/2/1/3/4213.jpg' @ error/jpeg.c/JPEGErrorHandler/322** *at line* **43** *in file*override/classes/ImageManager.php`

    38.            }
    39.            if ($regenerate || !file_exists(_PS_TMP_IMG_DIR_.$cacheImage)) {
    40.                if (!parent::checkImageMemoryLimit($image)) {
    41.                    return '';
    42.                }
    43. =>             $srcImage = new Imagick($image);
    44.                self::trimImage($srcImage);
    45.                $x = $srcImage->getImageWidth();
    46.                $y = $srcImage->getImageHeight();
    47.                $maxX = $size * 3;
    48.                $ratioX = $x / ($y / $size);
    
    • Imagick->__construct - [line 43 - override/classes/ImageManager.php]
    • [1 Arguments]
    38.            }
    39.            if ($regenerate || !file_exists(_PS_TMP_IMG_DIR_.$cacheImage)) {
    40.                if (!parent::checkImageMemoryLimit($image)) {
    41.                    return '';
    42.                }
    43. =>             $srcImage = new Imagick($image);
    44.                self::trimImage($srcImage);
    45.                $x = $srcImage->getImageWidth();
    46.                $y = $srcImage->getImageHeight();
    47.                $maxX = $size * 3;
    48.                $ratioX = $x / ($y / $size);
    
    /store/img/p/4/2/1/3/4213.jpg
    
    • ImageManager::thumbnail - [line 519 - classes/helper/HelperList.php]
    • [4 Arguments]
    514.                        if ($params['image'] != 'p' || Configuration::get('PS_LEGACY_IMAGES')) {
    515.                            $pathToImage = _PS_IMG_DIR_.$params['image'].'/'.$itemId.(isset($tr['id_image']) ? '-'.(int) $tr['id_image'] : '').'.'.$this->imageType;
    516.                        } else {
    517.                            $pathToImage = _PS_IMG_DIR_.$params['image'].'/'.Image::getImgFolderStatic($tr['id_image']).(int) $tr['id_image'].'.'.$this->imageType;
    518.                        }
    519. =>                     $this->_list[$index][$key] = ImageManager::thumbnail($pathToImage, $this->table.'_mini_'.$itemId.'_'.$this->context->shop->id.'.'.$this->imageType, 45, $this->imageType);
    520.                    } elseif (isset($params['icon']) && isset($tr[$key]) && (isset($params['icon'][$tr[$key]]) || isset($params['icon']['default']))) {
    521.                        if (!$this->bootstrap) {
    522.                            if (isset($params['icon'][$tr[$key]]) && is_array($params['icon'][$tr[$key]])) {
    523.                                $this->_list[$index][$key] = [
    524.                                    'src' => $params['icon'][$tr[$key]]['src'],
    
    store/img/p/4/2/1/3/4213.jpg
    Argument [1]  
    product_mini_1350_1.jpg
    Argument [2]  
    45
    Argument [3]  
    jpg
    
    • HelperListCore->displayListContent - [line 154 - classes/helper/HelperList.php]
    149.            $this->orderWay = preg_replace('/^([a-z _]*!)/Ui', '', $this->orderWay);
    150.    
    151.            $this->tpl->assign(
    152.                [
    153.                    'header'  => $this->displayListHeader(), // Display list header (filtering, pagination and column names)
    154. =>                 'content' => $this->displayListContent(), // Show the content of the table
    155.                    'footer'  => $this->displayListFooter(), // Close list table and submit button
    156.                ]
    157.            );
    158.    
    159.            return parent::generate();
    

    I disabled the Imagemagick module and the upload was successful - sort of. About half of the images were not imported so I then enabled imagemagick and manually uploaded them. The sort fuction now works fine. I haven’t tried another upload yet. I will post an update when I do.



  • Disabling and enabling ImageMagick did not fix the upload problem. The import still fails if the module is enabled (without an error message). When it is disabled the products are imported but not all the photos.


  • administrators

    Premature end of JPEG file

    Doesn’t look like the source files are okay.


  • administrators

    I found this great answer on stackoverflow.

    If you are unable to fix the source files, but want to recover as much as possible, change your php.ini and set gd.jpeg_ignore_warning=1

    Source: https://stackoverflow.com/a/42043015


  • administrators

    and disable ImageMagick



  • @mdekker The source files were not imported correctly, that is why I got the error and could not sort. By disabling ImageMagick and reimporting the file it fixed that problem. It seems it is a problem with the image import on 1.0.3. I am going to dig around a bit more and see if I can find the problem.



  • I downloaded 1.0.3 to my computer and checked the files in the download against the files on the server and found that there seemed to be quite a few which had differences. So I uploaded the files from my computer to the server using filezilla set to skip any which were the same size. I just did an upload and it went through without a hitch, so something must not have updated correctly with the upgrade module.


  • administrators

    change your php.ini and set gd.jpeg_ignore_warning=1



  • I changed my back office theme from thirtybees to blue and the problem has gone away.


  • administrators

    I can assure you that is not related at all, so it must be something else. Have you changed your php.ini yet and/or checked those settings are the same?


Log in to reply
 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.