1

I have been trying to upload image in magento 2 for a product but its giving me error. If I try to upload image for existing product it gives same error.

Notice: A non well formed numeric value encountered in /home/basecooking/orders.basecooking.se/vendor/magento/framework/Image/Adapter/Gd2.php on line 344

When I checked logs, I got these

[2017-05-12 18:29:13] main.CRITICAL: Exception: Notice: A non well formed numeric value encountered in /home/basecooking/orders.basecooking.se/vendor/magento/framework/Image/Adapter/Gd2.php on line 344 in /home/basecooking/orders.basecooking.se/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace:
#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(8, 'A non well form...', '/home/basecooki...', 344, Array)
#1 /home/basecooking/orders.basecooking.se/vendor/magento/framework/Image/Adapter/Gd2.php(344): imagecreatetruecolor('100 ', '136')
#2 /home/basecooking/orders.basecooking.se/vendor/magento/framework/Image.php(119): Magento\Framework\Image\Adapter\Gd2->resize('100 ', '136')
#3 /home/basecooking/orders.basecooking.se/vendor/magento/module-catalog/Model/Product/Image.php(578): Magento\Framework\Image->resize('100 ', '136')
#4 /home/basecooking/orders.basecooking.se/vendor/magento/module-catalog/Helper/Image.php(460): Magento\Catalog\Model\Product\Image->resize()
#5 /home/basecooking/orders.basecooking.se/vendor/magento/module-catalog/Helper/Image.php(523): Magento\Catalog\Helper\Image->applyScheduledActions()
#6 /home/basecooking/orders.basecooking.se/vendor/magento/module-catalog/Model/Product/Image/Cache.php(126): Magento\Catalog\Helper\Image->save()
#7 /home/basecooking/orders.basecooking.se/vendor/magento/module-catalog/Model/Product/Image/Cache.php(88): Magento\Catalog\Model\Product\Image\Cache->processImageData(Object(Magento\Catalog\Model\Product\Interceptor), Array, '/b/e/beef_rub_f...')
#8 /home/basecooking/orders.basecooking.se/vendor/magento/module-catalog/Model/Product.php(930): Magento\Catalog\Model\Product\Image\Cache->generate(Object(Magento\Catalog\Model\Product\Interceptor))
#9 /home/basecooking/orders.basecooking.se/var/generation/Magento/Catalog/Model/Product/Interceptor.php(362): Magento\Catalog\Model\Product->afterSave()
#10 /home/basecooking/orders.basecooking.se/vendor/magento/framework/EntityManager/Observer/AfterEntitySave.php(34): Magento\Catalog\Model\Product\Interceptor->afterSave()
#11 /home/basecooking/orders.basecooking.se/vendor/magento/framework/Event/Invoker/InvokerDefault.php(73): Magento\Framework\EntityManager\Observer\AfterEntitySave->execute(Object(Magento\Framework\Event\Observer))
#12 /home/basecooking/orders.basecooking.se/vendor/magento/framework/Event/Invoker/InvokerDefault.php(61): Magento\Framework\Event\Invoker\InvokerDefault->_callObserverMethod(Object(Magento\Framework\EntityManager\Observer\AfterEntitySave), Object(Magento\Framework\Event\Observer))
#13 /home/basecooking/orders.basecooking.se/vendor/magento/framework/Event/Manager.php(66): Magento\Framework\Event\Invoker\InvokerDefault->dispatch(Array, Object(Magento\Framework\Event\Observer))
#14 /home/basecooking/orders.basecooking.se/var/generation/Magento/Framework/Event/Manager/Proxy.php(95): Magento\Framework\Event\Manager->dispatch('magento_catalog...', Array)
#15 /home/basecooking/orders.basecooking.se/vendor/magento/framework/EntityManager/EventManager.php(51): Magento\Framework\Event\Manager\Proxy->dispatch('magento_catalog...', Array)
#16 /home/basecooking/orders.basecooking.se/vendor/magento/framework/EntityManager/Operation/Update.php(108): Magento\Framework\EntityManager\EventManager->dispatchEntityEvent('Magento\\Catalog...', 'save_after', Array)
#17 /home/basecooking/orders.basecooking.se/vendor/magento/framework/EntityManager/EntityManager.php(87): Magento\Framework\EntityManager\Operation\Update->execute(Object(Magento\Catalog\Model\Product\Interceptor), Array)
#18 /home/basecooking/orders.basecooking.se/vendor/magento/module-catalog/Model/ResourceModel/Product.php(695): Magento\Framework\EntityManager\EntityManager->save(Object(Magento\Catalog\Model\Product\Interceptor))
#19 /home/basecooking/orders.basecooking.se/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Catalog\Model\ResourceModel\Product->save(Object(Magento\Catalog\Model\Product\Interceptor))
#20 /home/basecooking/orders.basecooking.se/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Model\ResourceModel\Product\Interceptor->___callParent('save', Array)
#21 /home/basecooking/orders.basecooking.se/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'save', Object(Magento\Catalog\Model\ResourceModel\Product\Interceptor), Array, 'apply_catalog_r...')
3
  • Post upload code if you have customized it May 13, 2017 at 5:05
  • there is not code. i did not make any changes. The only thing i did is i was trying to normally upload a image for product in admin panel
    – Param Veer
    May 13, 2017 at 7:35
  • try to update your composer May 13, 2017 at 7:36

2 Answers 2

1

Try check your setting:

Stories > Configuration > Advance > developer >Image Processing Settings > PHP GD2 

Refesh cache and upload again.

0

Try this command in your project root:

composer update
12
  • well actually spending a lot of time tonight on this. I found that it was not able to write files in the magento catalog directory. But i am not even able to fix that.
    – Param Veer
    May 13, 2017 at 7:37
  • give permission 777 to your project and then call composer update command May 13, 2017 at 7:38
  • I tried with 777 but lemme try the composer one
    – Param Veer
    May 13, 2017 at 7:40
  • It says invalid credentials for https//repo.magento.com aborting
    – Param Veer
    May 13, 2017 at 7:42
  • you need to apply that command from your root of the project May 13, 2017 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.