Re: Image Handler 5 (for v1.5.5) Support Thread
Thanks for that! It looks like the 'transparent' setting for those 3 values is the root-cause of those logs. I'll be further investigating and have created a GitHub issue (https://github.com/lat9/zen_Image-Handler/issues/17) to track associated changes.
Re: Image Handler 5 (for v1.5.5) Support Thread
Quote:
Originally Posted by
lat9
I have currently solved it by replacing part on the code around line 1055:
/**
* @param $bg
*
* @return array|false
*/
protected function get_background_rgb($bg)
{
$color = false;
$bg = trim(str_replace('transparent', '', $bg));
list($red, $green, $blue)= preg_split('/[, :]/', $bg);
if (preg_match('/\d+/', $red.$green.$blue)) {
$red = min((int)$red, 255);
$green = min((int)$green, 255);
$blue = min((int)$blue, 255);
$color = ['r' => $red, 'g' => $green, 'b' => $blue];
}
return $color;
}
Replaced with:
protected function get_background_rgb($bg)
{
$color = false;
$bg = trim(str_replace('transparent', '', $bg));
$components = preg_split('/[, :]/', $bg);
if (count($components) === 3 && preg_match('/^\d+$/', $components[0]) && preg_match('/^\d+$/', $components[1]) && preg_match('/^\d+$/', $components[2])) {
$red = min((int)$components[0], 255);
$green = min((int)$components[1], 255);
$blue = min((int)$components[2], 255);
$color = ['r' => $red, 'g' => $green, 'b' => $blue];
}
return $color;
}
Re: Image Handler 5 (for v1.5.5) Support Thread
Quote:
Originally Posted by
siilike1232
I have currently solved it by replacing part on the code around line 1055:
/**
* @param $bg
*
* @return array|false
*/
protected function get_background_rgb($bg)
{
$color = false;
$bg = trim(str_replace('transparent', '', $bg));
list($red, $green, $blue)= preg_split('/[, :]/', $bg);
if (preg_match('/\d+/', $red.$green.$blue)) {
$red = min((int)$red, 255);
$green = min((int)$green, 255);
$blue = min((int)$blue, 255);
$color = ['r' => $red, 'g' => $green, 'b' => $blue];
}
return $color;
}
Replaced with:
protected function get_background_rgb($bg)
{
$color = false;
$bg = trim(str_replace('transparent', '', $bg));
$components = preg_split('/[, :]/', $bg);
if (count($components) === 3 && preg_match('/^\d+$/', $components[0]) && preg_match('/^\d+$/', $components[1]) && preg_match('/^\d+$/', $components[2])) {
$red = min((int)$components[0], 255);
$green = min((int)$components[1], 255);
$blue = min((int)$components[2], 255);
$color = ['r' => $red, 'g' => $green, 'b' => $blue];
}
return $color;
}
Thanks for that.
Re: Image Handler 5 (for v1.5.5) Support Thread
im getting this error on zen version 1.56c
PHP Warning: imagecreatefrompng(): '/var/www/clients/client1/web3/web/images/product_pictures/3 Commercial Stair NosingBA_01.png' is not a valid PNG file in /var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php on line 919.
Code:
[17-Aug-2024 18:58:20 UTC] Request URI: /Metal_Trim_Transitions/Carpet_Carpet_Tile_Solutions/Carpet_Stair_Nosing/3_Commercial_Stair_Nosing/Futura_CM_609_3_Commercial_Stair_Nosing_12_Length_Buffed_Aluminum, IP address: 193.116.224.72
#1 imagecreatefrompng() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:919]
#2 ih_image->load_imageGD() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:717]
#3 ih_image->resize_imageGD() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:400]
#4 ih_image->get_resized_image() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:258]
#5 ih_image->get_local() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/functions_bmz_image_handler.php:123]
#6 handle_image() called at [/var/www/clients/client1/web3/web/includes/functions/html_output.php:202]
#7 zen_image() called at [/var/www/clients/client1/web3/web/includes/modules/marcus/additional_images.php:150]
#8 require(/var/www/clients/client1/web3/web/includes/modules/marcus/additional_images.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_modules_additional_images.php:13]
#9 require(/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_modules_additional_images.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_product_info_display.php:47]
#10 require(/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_product_info_display.php) called at [/var/www/clients/client1/web3/web/includes/modules/pages/product_info/main_template_vars.php:281]
#11 require(/var/www/clients/client1/web3/web/includes/modules/pages/product_info/main_template_vars.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/common/tpl_main_page.php:261]
#12 require(/var/www/clients/client1/web3/web/includes/templates/marcus/common/tpl_main_page.php) called at [/var/www/clients/client1/web3/web/index.php:97]
--> PHP Warning: imagecreatefrompng(): '/var/www/clients/client1/web3/web/images/product_pictures/3 Commercial Stair NosingBA_01.png' is not a valid PNG file in /var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php on line 919.
Re: Image Handler 5 (for v1.5.5) Support Thread
Quote:
Originally Posted by
jimmie
im getting this error on zen version 1.56c
PHP Warning: imagecreatefrompng(): '/var/www/clients/client1/web3/web/images/product_pictures/3 Commercial Stair NosingBA_01.png' is not a valid PNG file in /var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php on line 919.
Code:
[17-Aug-2024 18:58:20 UTC] Request URI: /Metal_Trim_Transitions/Carpet_Carpet_Tile_Solutions/Carpet_Stair_Nosing/3_Commercial_Stair_Nosing/Futura_CM_609_3_Commercial_Stair_Nosing_12_Length_Buffed_Aluminum, IP address: 193.116.224.72
#1 imagecreatefrompng() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:919]
#2 ih_image->load_imageGD() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:717]
#3 ih_image->resize_imageGD() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:400]
#4 ih_image->get_resized_image() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:258]
#5 ih_image->get_local() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/functions_bmz_image_handler.php:123]
#6 handle_image() called at [/var/www/clients/client1/web3/web/includes/functions/html_output.php:202]
#7 zen_image() called at [/var/www/clients/client1/web3/web/includes/modules/marcus/additional_images.php:150]
#8 require(/var/www/clients/client1/web3/web/includes/modules/marcus/additional_images.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_modules_additional_images.php:13]
#9 require(/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_modules_additional_images.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_product_info_display.php:47]
#10 require(/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_product_info_display.php) called at [/var/www/clients/client1/web3/web/includes/modules/pages/product_info/main_template_vars.php:281]
#11 require(/var/www/clients/client1/web3/web/includes/modules/pages/product_info/main_template_vars.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/common/tpl_main_page.php:261]
#12 require(/var/www/clients/client1/web3/web/includes/templates/marcus/common/tpl_main_page.php) called at [/var/www/clients/client1/web3/web/index.php:97]
--> PHP Warning: imagecreatefrompng(): '/var/www/clients/client1/web3/web/images/product_pictures/3 Commercial Stair NosingBA_01.png' is not a valid PNG file in /var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php on line 919.
That's PHP saying that it doesn't like product_pictures/3 Commercial Stair NosingBA_01.png.
That could be because (a) the file's not a valid .png format or (b) the file name has those unwanted blanks in its name.
Re: Image Handler 5 (for v1.5.5) Support Thread
i am getting thousands of theses in logs and each1 is a different picture
Code:
[10-Sep-2024 12:45:35 UTC] Request URI: /Flooring/Tile_Stone/SFI_Porcelain_Wood_Plank/SFI_Porcelain_Wood_Plank_Bullnose/Townhouse_Bullnose_Collection/Townhouse_Bullnose_6_x_24_Wood_Barrel_TY03BN, IP address: 85.208.96.194
#1 imagecreatefromjpeg() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:926]
#2 ih_image->load_imageGD() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:717]
#3 ih_image->resize_imageGD() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:400]
#4 ih_image->get_resized_image() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:258]
#5 ih_image->get_local() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/functions_bmz_image_handler.php:123]
#6 handle_image() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/pzen_marcus_template_functions.php:74]
#7 pzen_marcus_image() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/pzen_marcus_template_functions.php:601]
#8 pzen_marcus_additional_images() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/pzen_marcus_template_functions.php:704]
#9 get_pzen_marcus_product_content() called at [/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_modules_related_products.php:65]
#10 require(/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_modules_related_products.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_product_info_display.php:657]
#11 require(/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_product_info_display.php) called at [/var/www/clients/client1/web3/web/includes/modules/pages/product_info/main_template_vars.php:281]
#12 require(/var/www/clients/client1/web3/web/includes/modules/pages/product_info/main_template_vars.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/common/tpl_main_page.php:261]
#13 require(/var/www/clients/client1/web3/web/includes/templates/marcus/common/tpl_main_page.php) called at [/var/www/clients/client1/web3/web/index.php:97]
--> PHP Warning: imagecreatefromjpeg(): gd-jpeg: JPEG library reports unrecoverable error: Not a JPEG file: starts with 0x89 0x50 in /var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php on line 926.
[10-Sep-2024 12:45:35 UTC] Request URI: /Flooring/Tile_Stone/SFI_Porcelain_Wood_Plank/SFI_Porcelain_Wood_Plank_Bullnose/Townhouse_Bullnose_Collection/Townhouse_Bullnose_6_x_24_Wood_Barrel_TY03BN, IP address: 85.208.96.194
#1 imagecreatefromjpeg() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:926]
#2 ih_image->load_imageGD() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:717]
#3 ih_image->resize_imageGD() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:400]
#4 ih_image->get_resized_image() called at [/var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php:258]
#5 ih_image->get_local() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/functions_bmz_image_handler.php:123]
#6 handle_image() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/pzen_marcus_template_functions.php:74]
#7 pzen_marcus_image() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/pzen_marcus_template_functions.php:601]
#8 pzen_marcus_additional_images() called at [/var/www/clients/client1/web3/web/includes/functions/extra_functions/pzen_marcus_template_functions.php:704]
#9 get_pzen_marcus_product_content() called at [/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_modules_related_products.php:65]
#10 require(/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_modules_related_products.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_product_info_display.php:657]
#11 require(/var/www/clients/client1/web3/web/includes/templates/marcus/templates/tpl_product_info_display.php) called at [/var/www/clients/client1/web3/web/includes/modules/pages/product_info/main_template_vars.php:281]
#12 require(/var/www/clients/client1/web3/web/includes/modules/pages/product_info/main_template_vars.php) called at [/var/www/clients/client1/web3/web/includes/templates/marcus/common/tpl_main_page.php:261]
#13 require(/var/www/clients/client1/web3/web/includes/templates/marcus/common/tpl_main_page.php) called at [/var/www/clients/client1/web3/web/index.php:97]
--> PHP Warning: imagecreatefromjpeg(): '/var/www/clients/client1/web3/web/images/product_pictures/LL04.jpg' is not a valid JPEG file in /var/www/clients/client1/web3/web/includes/classes/bmz_image_handler.class.php on line 926.
Re: Image Handler 5 (for v1.5.5) Support Thread
what color profile do the jpg files e.g. LL04.jpg have?
You can send it to me via mail if you don't know how to check it.
Re: Image Handler 5 (for v1.5.5) Support Thread
0x89 0x50 means that the image is actually a png file, but is misnammed with a jpg extension.
Re: Image Handler 5 (for v1.5.5) Support Thread
Quote:
Originally Posted by
gothstone
0x89 0x50 means that the image is actually a png file, but is misnammed with a jpg extension.
hmmm... interesting bit of information....
perhaps image handler should handle files with misnamed extensions?
Re: Image Handler 5 (for v1.5.5) Support Thread
Possible, but a lot of work. And if you go there you might as well add in removing invalid characters, fixing double extensions, etc. Certainly wouldn't be bad if someone wants to spend the time coding it.
In case someone does, png starts with 0x89 0x50
Jpg is 0xFF 0xD8
Gif is 0x47 0x49 0x46