ZenCart 后台上传图片出现Cannot Initialize new GD image stream,一看到这个提示就知道与GD库有关,查看了下空间配置已经支持GD库,那该怎么解决呢。
还有一大串提示:
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in public_html/admin/includes/modules/new_product_preview.php on line 80
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /public_html/admin/includes/modules/product_preview.php on line 81
Warning: imagefill(): supplied argument is not a valid Image resource in /public_html/admin/includes/modules/product_preview.php on line 82
Warning: imagecopyresized(): supplied argument is not a valid Image resource in /public_html/admin/includes/modules/product_preview.php on line 90
Warning: imagejpeg(): supplied argument is not a valid Image resource in /public_html/admin/includes/modules/product_preview.php on line 94
Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /public_html/admin/includes/modules/product_preview.php on line 120
Warning: imagefill(): supplied argument is not a valid Image resource in /public_html/admin/includes/modules/product_preview.php on line 121
Warning: imagecopyresized(): supplied argument is not a valid Image resource in /public_html/admin/includes/modules/product_preview.php on line 129
Warning: imagecopymerge(): supplied argument is not a valid Image resource in /public_html/admin/includes/modules/product_preview.php on line 135
Cannot Initialize new GD image stream
网上搜索了一翻,终于找到了答案:
原因是:admin/includes/modules/new_product_preview.php 文件中的
$im_s = @imagecreatetruecolor( PRODUCT_MEDIUM_SMALL_WIDTH, PRODUCT_MEDIUM_SMALL_HEIGHT ) or die(“Cannot Initialize new GD image stream”);这行代码中的 PRODUCT_MEDIUM_SMALL_WIDTH, PRODUCT_MEDIUM_SMALL_HEIGHT的值没有读取到,是非法值。
解决方案:删除此代码中的or die(“Cannot Initialize new GD image stream”);
重新打开后台看了下,终于可以了!