KissIT Image Thumbnailer

Error when using a space in name - KissIT Image Thumbnailer

Error when using a space in name

by Pierre_P » Tue Dec 17, 2024 7:36 am

Busy playing around with a 1.0.9.9 store

Renaming the image name for example orange-1.jpg to orange 1.jpg and putting in a space will produce many errors and break the page in admin
Example to replicate, in new install go to admin/catalog.php?cPath=1_4&pID=1 or edit oranges
Upload a new image for oranges but insert a space in like orange 1.jpg and save

This errors spills over to other modules as well.
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Contact:

Re: Error when using a space in name

by raiwa » Tue Dec 17, 2024 11:52 am

Spaces in image names are not recommended for web use.
However I checked and get no errors. The blank spaces are replaced by hyphens in the thumbnail.
You may post the errors you get, your exact Phoenix, PHP and kissit image versions. Please see the Need Help link in my footer.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Contact:

Re: Error when using a space in name

by Pierre_P » Wed Dec 18, 2024 6:36 am

I myself also does not like spaces in the names, however dealing with existing images.

Kissit Version 4.7.1
Tested on PHP 8.0 and PHP 8.2
Error exist in ver 1.0.9.9 and 1.0.9.10

I am able to re produce it.
In admin clear the thumbs cache.
If the thumb were already created in catalog side there will be no errors.

Edit products and upload image with a name that contains a space.
After saving the error will be, the same for when you add it to special, featured and so on where the image of the product needs to be displayed in admin

Code: Select all

Notice: Could not extract image size. in /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php on line 211 Warning: Trying to access array offset on value of type bool in /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php on line 215 Warning: Trying to access array offset on value of type bool in /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php on line 216 Warning: Trying to access array offset on value of type bool in /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php on line 217 Notice: Image extension is invalid or not supported. in /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php on line 151 Fatal error: Uncaught DivisionByZeroError: Division by zero in /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php:297 Stack trace: #0 /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_helper.php(166): image_kissit->resize(800, 800, '1') #1 /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_helper.php(104): image_helper->_generateThumbnail() #2 /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_helper.php(78): image_helper->assemble() #3 /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image.php(224): image_helper::generate_thumb(Object(Image)) #4 /usr/www/users/--/admin/includes/actions/catalog/infoboxes/default.php(53): Image->__toString() #5 /usr/www/users/--/admin/includes/components/infobox.php(15): require('/usr/www/users/...') #6 /usr/www/users/--/admin/includes/actions/catalog/views/default.php(182): require('/usr/www/users/...') #7 /usr/www/users/--/admin/catalog.php(48): require('/usr/www/users/...') #8 {main} Next TypeError: imagedestroy(): Argument #1 ($image) must be of type GdImage, string given in /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php:202 Stack trace: #0 /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php(202): imagedestroy('') #1 /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_helper.php(104): image_kissit->__destruct() #2 /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_helper.php(78): image_helper->assemble() #3 /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image.php(224): image_helper::generate_thumb(Object(Image)) #4 /usr/www/users/--/admin/includes/actions/catalog/infoboxes/default.php(53): Image->__toString() #5 /usr/www/users/--/admin/includes/components/infobox.php(15): require('/usr/www/users/...') #6 /usr/www/users/--/admin/includes/actions/catalog/views/default.php(182): require('/usr/www/users/...') #7 /usr/www/users/--/admin/catalog.php(48): require('/usr/www/users/...') #8 {main} thrown in /usr/www/users/--/includes/system/override/kiss_image_thumbnailer/image_kissit.php on line 202
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Contact:

Re: Error when using a space in name

by raiwa » Wed Dec 18, 2024 3:05 pm

I can't reproduce this error, but get a a related error more on the root of the problem:
Please try to change in:
includes\system\override\kiss_image_thumbnailer\image_helper.php lin 135

Code: Select all

      	if ( !$this->_original_image_info = getimagesize ( $this->src ) ) {
to:

Code: Select all

      	if ( !is_file($this->src) || !$this->_original_image_info = getimagesize ( $this->src ) ) {
Please report back.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Contact:

Re: Error when using a space in name

by Pierre_P » Wed Dec 18, 2024 4:47 pm

I added a bit more to your suggestion as it still complained on page admin/catalog.php

Code: Select all

if ( KISSIT_MAIN_PRODUCT_WATERMARK_SIZE == 0 || !file_exists($this->src)) {
            if ( !is_file($this->src) || !$this->_original_image_info = getimagesize ( $this->src ) ) {
      		return 'abort';
      	}
After this I could not find any other errors produced - will let you know if any
Thanx
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Contact: