Author Topic: imagecreatetruecolor() error on product creation  (Read 743 times)

adamol

  • Beginner
  • *
  • Posts: 3
imagecreatetruecolor() error on product creation
« on: March 10, 2023, 21:24:31 PM »
Hello,

I just updated an old site to PHP 8.0 and upon new product creation, I get the error 

imagecreatetruecolor(): Argument #1 ($width) must be greater than 0

When I turn off dynamic thumbnail resizing option, the error goes away.  Does anyone have ideas what could be going on here?

Thanks

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10878
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

adamol

  • Beginner
  • *
  • Posts: 3
Re: imagecreatetruecolor() error on product creation
« Reply #2 on: March 10, 2023, 22:05:27 PM »
Apologies...

Virtuemart 4.0.12
PHP 8.0.28
Joomla 3.10.11

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10878
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: imagecreatetruecolor() error on product creation
« Reply #3 on: March 11, 2023, 11:50:21 AM »
template ?  try with the standard Beez template to test
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Adamol2

  • Beginner
  • *
  • Posts: 2
  • A beginner
Re: imagecreatetruecolor() error on product creation
« Reply #4 on: September 09, 2023, 23:02:51 PM »
Hello,

I tried other templates, but it still does not work.  I created a new site with a fresh installation and this does not create any errors, so there must be something with the template or database?  The following is the call stack from when I edit or create a new product, or even click on the media file icon in the product list.

I created this site using softaculous as a test site to upgrade to J4.

Any help is greatly appreciated!!

Thank you


An error has occurred.
0 imagejpeg(): Argument #1 ($image) must be of type GdImage, bool given
Call stack
#   Function   Location
1   ()   JROOT/administrator/components/com_virtuemart/helpers/img2thumb.php:424
2   imagejpeg()   JROOT/administrator/components/com_virtuemart/helpers/img2thumb.php:424
3   Img2Thumb->NewImgSave()   JROOT/administrator/components/com_virtuemart/helpers/img2thumb.php:153
4   Img2Thumb->NewImgCreate()   JROOT/administrator/components/com_virtuemart/helpers/img2thumb.php:102
5   Img2Thumb->__construct()   JROOT/administrator/components/com_virtuemart/helpers/image.php:184
6   VmImage->createThumb()   JROOT/administrator/components/com_virtuemart/helpers/mediahandler.php:657
7   VmMediaHandler->displayMediaThumb()   JROOT/administrator/templates/vmadmin/html/com_virtuemart/sublayouts/images.php:291
8   include()   JROOT/administrator/templates/vmadmin/html/com_virtuemart/helpers/adminsublayouts.php:64
9   adminSublayouts::renderAdminVmSubLayout()   JROOT/administrator/templates/vmadmin/html/com_virtuemart/helpers/vmuikit_mediahandler.php:60
10   VmuikitMediaHandler::displayFilesHandler()   JROOT/administrator/templates/vmadmin/html/com_virtuemart/product/product_edit_images.php:35
11   include()   JROOT/libraries/src/MVC/View/HtmlView.php:410
12   Joomla\CMS\MVC\View\HtmlView->loadTemplate()   JROOT/administrator/templates/vmadmin/html/com_virtuemart/sublayouts/buildtabs.php:63
13   include()   JROOT/administrator/templates/vmadmin/html/com_virtuemart/helpers/adminsublayouts.php:64
14   adminSublayouts::renderAdminVmSubLayout()   JROOT/administrator/templates/vmadmin/html/com_virtuemart/helpers/vmuikit_adminuihelper.php:250
15   vmuikitAdminUIHelper::buildTabs()   JROOT/administrator/templates/vmadmin/html/com_virtuemart/product/product_edit.php:52
16   include()   JROOT/libraries/src/MVC/View/HtmlView.php:410
17   Joomla\CMS\MVC\View\HtmlView->loadTemplate()   JROOT/administrator/components/com_virtuemart/helpers/vmviewadmin.php:78
18   VmViewAdmin->display()   JROOT/administrator/components/com_virtuemart/views/product/view.html.php:589
19   VirtuemartViewProduct->display()   JROOT/administrator/components/com_virtuemart/helpers/vmcontroller.php:126
20   VmController->display()   JROOT/administrator/components/com_virtuemart/helpers/vmcontroller.php:151
21   VmController->edit()   JROOT/administrator/components/com_virtuemart/controllers/product.php:46
22   VirtuemartControllerProduct->edit()   JROOT/libraries/src/MVC/Controller/BaseController.php:678
23   Joomla\CMS\MVC\Controller\BaseController->execute()   JROOT/administrator/components/com_virtuemart/virtuemart.php:77
24   require_once()   JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
25   Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}()   JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
26   Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch()   JROOT/libraries/src/Component/ComponentHelper.php:361
27   Joomla\CMS\Component\ComponentHelper::renderComponent()   JROOT/libraries/src/Application/AdministratorApplication.php:143
28   Joomla\CMS\Application\AdministratorApplication->dispatch()   JROOT/libraries/src/Application/AdministratorApplication.php:186
29   Joomla\CMS\Application\AdministratorApplication->doExecute()   JROOT/libraries/src/Application/CMSApplication.php:293
30   Joomla\CMS\Application\CMSApplication->execute()   JROOT/administrator/includes/app.php:61
31   require_once()   JROOT/administrator/index.php:32

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10878
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.8.8
Re: imagecreatetruecolor() error on product creation
« Reply #5 on: September 11, 2023, 12:13:27 PM »
Is your GD library enabled in the php 8

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Adamol2

  • Beginner
  • *
  • Posts: 2
  • A beginner
Re: imagecreatetruecolor() error on product creation
« Reply #6 on: September 18, 2023, 00:09:16 AM »
Yes, it is.  From System Info:


=============
   gd
   =============
   GD Support: enabled
   GD Version: bundled (2.1.0 compatible)
   FreeType Support: enabled
   FreeType Linkage: with freetype
   FreeType Version: 2.8.0
   GIF Read Support: enabled
   GIF Create Support: enabled
   JPEG Support: enabled
   libJPEG Version: 6b
   PNG Support: enabled
   libPNG Version: 1.5.13
   WBMP Support: enabled
   XPM Support: enabled
   libXpm Version: 30411
   XBM Support: enabled
   WebP Support: enabled
   BMP Support: enabled
   TGA Read Support: enabled

      =============
      gd.jpeg_ignore_warning
      =============
      Local Value: 1
      Master Value: 1