KissIT Image Thumbnailer Support

Recommended Posts

Hi Ed,

I suppose you are using the latest KissIT image thumbnailer 3.4.1. :

I checked in my develp store and can't see this error.

These constants are defined in the KissIt Gallery module.

Please try to uninstall and reinstall the module.

Share on other sites

I uninstalled and reinstalled with no change. Here's the list of scalars etc. from an Xdebug breakpoint at pi_gallery_kissit.php line 84. I noticed it shows KISSIT_IMAGE_MODULE at 3.4.0 but I'm pretty sure I installed 3.4.1. Since I had a little trouble getting the upload files in the right places I wouldn't be surprised to find something out of place. I'll double check that.

Edited by edfaught
I always edit the first draft.

Share on other sites
On 9/16/2020 at 1:59 AM, raiwa said:

These constants are defined in the KissIt Gallery module.

I have found my problem I think: I have overridden class pi_options_attributes and I know that I have to define the constants myself (Though I don't know why).

As my learning curve is somewhat hampered I ask you if this make sense?

Share on other sites

Hi Ed,

The attributes module is not related.

However I found now the confusion. It was created by using the wrong content module constant in the pi module.

That's why I checked the content module, but you are using the pi module.

The pi module has the constants missing, apart of using the wrong one in the output.

I fixed it now. Please try this one:

includes/modules/pi/product_info/pi_gallery_kissit.php

You need to uninstall yours, replace it and install again.

Please confirm and I'll update the package.

Thanks
Rainer

Edited by raiwa

Share on other sites
Quote

Warning
: Use of undefined constant MODULE_CONTENT_PI_GALLERY_KISSIT_MAIN_IMAGE_WIDTH - assumed 'MODULE_CONTENT_PI_GALLERY_KISSIT_MAIN_IMAGE_WIDTH' (this will throw an Error in a future version of PHP) in

At least the error on line 88 went away...

Share on other sites

Uploaded update with the above fix:

Requires Phoenix 1.0.7.4+
Tested with Phoenix 1.0.7.7

Change log 3.4.2:

- fixed wrong and missing constant in pi gallery kissit module. Thanks to @edfaught

Share on other sites

Hi,
I just installed this addon (3.4.2) into 1.0.7.9.

One fix needed in
/catalog/includes/modules/pi_gallery_kissit.php

move the line #94 containing
$other_img_indicator =$other_img = null;

upwards after the comment line #81
// now create the thumbs

(just like in the stock pi_gallery.php) to get rid of "Notice: Undefined variable: other_img_indicator " later on.

Question:
Is it really necessary to create .htaccess into every thumbs subfolder?

The .htaccess  from an upper level folder, like images, will be inherited by every subfolder and should be enough.

Edited by vmn

Share on other sites

Thanks @vmn,

Quote

One fix needed in
/catalog/includes/modules/pi_gallery_kissit.php

Quote

The .htaccess  from an upper level folder, like images, will be inherited by every subfolder and should be enough.

You are right. I'll change both issues in the next update.

To avoid creating the .htaccess in subdirectories, in the includes/functions/kiss_it_image.php function, just remove line 83-90:

        // create .htacces protection like in main image dir
if (($i==$n-1) && (!is_file($thumbs_dir . '.htaccess')) ) {$hpname = $thumbs_dir . '.htaccess'; if ($hp = fopen($hpname,'w')) { fwrite($hp,$htacces); fclose($hp);
}
}

Edited by raiwa

Share on other sites

Thanks,

actually, for testing purposes, I commented out everything related creating .htaccess in the file above file before notifying you.The images folder .htaccess already contains the required protection.

Share on other sites
4 minutes ago, vmn said:

actually, for testing purposes, I commented out everything related creating .htaccess in the file above file before notifying you.The images folder .htaccess already contains the required protection. ﻿

Yep, I forgot that the thumbs folder is always inside the image directory. In earlier versions it was in the kissit directory and I supposed it can be still configured to be elsewhere.

Share on other sites

OK, it might be safer to always add .htaccess into the thumbs top-level folder.

Edited by vmn

Share on other sites

You can also create all folders without looping:

if(!is_dir($thumbs_dir_path)) { mkdir($thumbs_dir_path,0777,true);
}

Share on other sites

Hi,

I've upgraded Phoenix from 1.0.7.9->1.0.7.10->1.0.7.11 and noticed that the Gallery Kissit setup stopped working.

I think I managed to upgrade pi_gallery_kissit.php to be compatible with 1.0.7.11. Maybe you already have done that. Here's my stuff.

pi_gallery_kissit.zip

Share on other sites

Hello all.

I have seen that the watermark image appears on top of an image on the checkout_payment.php page. All the images on the rest of the pages are shown normally.

I have cleared the cache but no change.

The KissIT version is 3.4.2 and the OC Phoenix is 1.0.7.11

Edited by gritsop

Share on other sites

Then the image  uses a watermark incompatible image format like png.

Convert the image to GIF por JPG or don't use watermark for this image.

See Instructions: Chart for supported image types and KissIt settings:

Edited by raiwa

Share on other sites

Hello Rainer.

Which image should i convert? If you mean the Credit Card Logos image, this cant be converted as the source code should be changed and it is  something that I cant do as the code is encrypted by the Bank. The Credit Card Logos image is in PNG format.

How can the watermark not be applied for the specific image on the specific page?

Edited by gritsop

Share on other sites

Instructions:

3. Optional if you are using watermark and wish to leave some images like the Store Logo without watermark applied:

 If you mean the Credit Card Logos image, this cant be converted as the source code should be changed

You can replace the tep_image function by calling the image via html "image src:......". Then no watermark will be applied

Edited by raiwa

Share on other sites

Hi,
I'm using Phoenix 1.0.7.11 and KissIT 3.4.2 and noticed that it creates empty folders for gallery images.
I verified this using stock versions of 1.0.7.11 and KissIT.

The function tep_image in kiss_it_image.php first creates a folder and the function _generateThumbnail in Image_Helper.php
does not need it, because thumbs are not used for gallery images.

This fix works for me. No empty folders will be created after applying it.

In kiss_it_image.php tep_image replace the lines between

// Create thumbs sub dirs and .htaccess.
and
// End create subdirectory and .htaccess.

as follows

//VMN NOT NEEDED Create thumbs sub dirs and .htaccess.
//VMN build thumbs sub dir path, in case it's needed
$thumbs_dir_path = str_replace('images/', 'images/' . KISSIT_THUMBS_MAIN_DIR .$width .'_'.$height.'/', dirname($src) . '/');

//VMN MOVED TO Image_Helper _generateThumbnail if(!is_dir($thumbs_dir_path)) { //VMN MOVED TO Image_Helper _generateThumbnail mkdir($thumbs_dir_path,0775,true);
//VMN MOVED TO Image_Helper _generateThumbnail }

//VMN NOT NEEDED because sub dirs are created using mkdir('path',mode,true)
//VMN NOT NEEDED $thumbs_dir = ''; //VMN NOT NEEDED$thumbs_dir_paths = explode("/",$thumbs_dir_path); //VMN NOT NEEDED for ($i=0, $n=sizeof($thumbs_dir_paths); $i<$n; $i++) { //VMN NOT NEEDED$thumbs_dir .= $thumbs_dir_paths[$i] . '/';
//VMN NOT NEEDED if(!is_dir($thumbs_dir)) { //VMN NOT NEEDED mkdir($thumbs_dir, 0775);
//VMN NOT NEEDED }

//VMN NOT NEEDED create .htacces protection like in main image dir
//VMN NOT NEEDED if (($i==$n-1) && (!is_file($thumbs_dir . '.htaccess')) ) { //VMN NOT NEEDED$hpname = $thumbs_dir . '.htaccess'; //VMN NOT NEEDED if ($hp = fopen($hpname,'w')) { //VMN NOT NEEDED fwrite($hp,$htacces); //VMN NOT NEEDED fclose($hp);
//VMN NOT NEEDED   }
//VMN NOT NEEDED }
//VMN NOT NEEDED} // end for
//VMN NOT NEEDED End create subdirectory and .htaccess.

There is no unnecessary creation of thumbs subfolders and htaccess files.
The main thumbs folder htaccess will protect supbfolders as well.
The only reference of $thumbs_dir_path is in$image = new Image_Helper(...).

================

in Image_Helper.php  _generateThumbnail below the line:

//make sure the thumbnail directory exists.

1. comment out/remove the lines

//VMN NOT NEEDED if ( !is_writable ( $this->thumbs_dir_path ) ) { //VMN NOT NEEDED trigger_error ( 'Cannot detect a writable thumbs directory!', E_USER_NOTICE ); //VMN NOT NEEDED } //VMN The check below is already done in _checkImage returning 'no_thumb_required' //VMN NOT NEEDED if ( is_readable ($this->_thumb_src ) ) {
//VMN NOT NEEDED    $this->_calculated_width = (int)$this->attributes['width'];
//VMN NOT NEEDED    $this->_calculated_height = (int)$this->attributes['height'];
//VMN NOT NEEDED    return $this->src =$this->_thumb_src;
//VMN NOT NEEDED }

//VMN moved from kiss_it_image.php
if(!is_dir($this->thumbs_dir_path)) { mkdir($this->thumbs_dir_path,0775,true); // true ->Allows the creation of nested directories specified in the pathname
}

Do you see any problems with this approach?

Share on other sites
Quote

because thumbs are not used for gallery images.

They are used if watermark is used.

Your solution looks good to me. I was also already thinking to move all the directory stuff into the helper class.

I'll check and test it for the next update. Thank You 😀

Edited by raiwa

Share on other sites

You're welcome.

I'm not using watermarks.

I also tried admin side thumbs. Empty folders are created there, too.

For some reason multiple thumbs were placed on some product lines in the category product listing, because your jquery code found multiple th elements to prepend the image to. I couldn't figure out why, so I removed the admin side thumbs functionality. It's not important to me. I was just curious:).

Share on other sites

@raiwa Curious if this might work with webP images?

The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Share on other sites

As far as I know, WebP images are not (yet) supported by the GD library which is used to generate the thumbs.

but the support needs to be added to kiss it.

I’ll check for the next update. But I don’t know if that version is already widely installed on the servers.

Edited by raiwa

Share on other sites
HI
using
Phoenix Edition v1.0.7.12
KissIT_image_thumbnailer_Pro_3.4.2

i have an error after i installed the addon,. i reload the website with the addon installed and get a blank index page and in the logs i am getting

[28-Dec-2020 16:18:01 Europe/London] PHP Fatal error:  Uncaught Error: Call to undefined function tep_image() in /templates/default/includes/components/product_card.php:1

thanks

Share on other sites

Hi its me. I have tried to figure this out but with no success.  Running under 7.12 php 7.4.

I went live and copied all the files over to the live URL.  The catalog side is working fine.  (as far as in tell)  The admin side lost the connection to the images.  At first I was missing the Phoenix images, but when I went to the admin > includes > configure.php  and removed the / from the the "const DIR_WS_CATALOG = '/';