News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

imagecreatetruecolor() error on product creation

Started by adamol, March 10, 2023, 21:24:31 PM

Previous topic - Next topic

adamol

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

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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

Apologies...

Virtuemart 4.0.12
PHP 8.0.28
Joomla 3.10.11

GJC Web Design

template ?  try with the standard Beez template to test
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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

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

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 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

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

Adamol2

Hello, I've been thinking this could be due to the Joomla/Virtuemart installation being in a subdirectory, but the database links should be relative to the images/stories/product folder.  The media files are present in that folder.

Adamol2

Hello,

After downgrading to PHP 7.4, the error is only a warning now, but no thumbnails are created still.  Virtuemart reports "NewImgResize failed x,y = 0".  The full size images are working. 

Jumbo!

Set a valid value (positive integer) for "Thumbnail Image Width" and "Thumbnail Image Height" in VirtueMart Configuration.

That will resolve the issue.

Adamol2

Hello,

Thank you so much.  This is working now.  I definitely tried this before but it is now working with this recommendation.