Jump to content
FWR Media

KissIT Image Thumnailer

Recommended Posts

Hello @,

 

Go through the update instructions in: upgrades/update for previous versions.doc

Beginn with:

Update Version 17 to 19 OsC 2.3.0 – 2.3.3.4 standard

or

Update Version 17 to 18 BS only

 

Then continue through all steps until 27

Maybe removing your actual version and do a complete new fresh installation could be easier and less work.

 

The only modifications which may be affected by template/customizations are in product_info.php.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

@, look in the installation instructions of your version and revert all what was done there.

Share this post


Link to post
Share on other sites

@@raiwa, removing and doing a fresh install does sound like a much easier option. How would you remove it though?

 

 

Use the backups you made before altering any files.

 

You should really keep a regular full store backup if you dont already.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

@@raiwa

 

I have Burt's latest EDGE version. When I make the edits to html_output.php, the product image disappears.

 

Please tell me what I need to check.

 

Thanks in advance.

Share this post


Link to post
Share on other sites

Hello @@discxpress,

 

More info would be needed to know where is the error.

 

- make sure you uploaded all new files to the correct place

- does it work on product listing and other places and only disappear on the product info page?

- if only on product info page: did you apply the additional modifications there?

- try to switch temporary error reporting to " error_reporting(E_ALL);" in application_top.php or see in your error_log if any error appears related to images

- try to right click on the image (alt text) to check the image path and post it

 

rgds

Rainer

Share this post


Link to post
Share on other sites

@@discxpress,

 

please read my first answer and also the troubleshooting section in the instructions.

Share this post


Link to post
Share on other sites

@raiwa

Bare with me as this may be a silly question but would it be possible to use this addon for sites that share images?

Long story but I have two sites, sharing one database and just looking to speed them both up a bit.

My only guess would be to have the separate site point to the thumbs directory somehow.

...I'm going to do more research but I'd thought I'd ask first for your thoughts.

Share this post


Link to post
Share on other sites

@SuperPower09,

 

the thumbs directory path uses the DIR_WS_IMAGES definition at the beginning. So if you have this correct defined to the shared image directory it should work. if you changed there something for example to an absolute path, make sure the thumbs path is correct.

You can check it within the tep_image function in html_output.php:

		if(!is_dir(DIR_WS_IMAGES . KISSIT_THUMBS_MAIN_DIR))mkdir(DIR_WS_IMAGES . KISSIT_THUMBS_MAIN_DIR, 0777);
	  if ( !is_file(DIR_WS_IMAGES . KISSIT_THUMBS_MAIN_DIR . '.htaccess') ) {
	    $hpname = DIR_WS_IMAGES . KISSIT_THUMBS_MAIN_DIR . '.htaccess';
    // Create thumbs sub dirs and .htaccess.	
    $thumbs_dir_path = str_replace(DIR_WS_IMAGES, DIR_WS_IMAGES . KISSIT_THUMBS_MAIN_DIR . $width .'_'.$height.'/', dirname($src) . '/');

rgds

Rainer

Share this post


Link to post
Share on other sites
On 2017-06-19 at 1:31 PM, SuperPower09 said:

My only guess would be to have the separate site point to the thumbs directory somehow.

...I'm going to do more research but I'd thought I'd ask first for your thoughts.

@SuperPower09 DeDe make sure you use a file system path for your thumbs/image define.  As I recall (I tripped over this before) is_file, which is used in the image_helper class, will not work with an absolute path.  My coffee wears off at this time of night so hopefully my memory is still serving me well.

Dan 

Share this post


Link to post
Share on other sites

Hi Everyone

I am trying to install the following script so i have Local and Remote Images available.

In /includes/functions/html_output.php

Find:

// The HTML image wrapper function
  function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $responsive = true, $bootstrap_css = '') {
    if ( (empty($src) || ($src == 'images/')) && (IMAGE_REQUIRED == 'false') ) {
      return false;
    }

Add After:

   if ( substr($src,strlen('images/'),4) == 'http') {
     if (file_exists ( substr($src,(strlen('images/')))) ){
       $src = substr($src,(strlen('images/')));
     } else {
       $src = 'images/no-image.jpg';
     }
   }

If KissIT Image Thumnailer r27 is installed on latest BS Edge i get following errors:

Warning: mkdir(): Invalid argument in <dir>/includes/functions/html_output.php on line 106

Warning: mkdir(): Invalid argument in <dir>/includes/functions/html_output.php on line 106

Warning: mkdir(): Invalid argument in <dir>/includes/functions/html_output.php on line 106

Warning: mkdir(): Invalid argument in <dir>/includes/functions/html_output.php on line 106

Warning: fopen(images/thumbs/250_250/http://file-7.ru//.htaccess): failed to open stream: Invalid argument in <dir>/includes/functions/html_output.php on line 116

Notice: Cannot detect a writable thumbs directory! in <dir>/includes/modules/kiss_image_thumbnailer/classes/Image_Helper.php on line 103

Warning: imagejpeg(images/thumbs/250_250/http://file-7.ru/no-image.jpg): failed to open stream: Invalid argument in <dir>/includes/modules/kiss_image_thumbnailer/classes/Image.php on line 145

If anyone could please help implement the IF Statement with KissIT would be much appreciated.

Share this post


Link to post
Share on other sites

Hello @CGhoST,

 

Try to add your code snippet at the very beginning of the tep_image function so it should look like this:

////
// New HTML image wrapper function modified for KISS Image Thumbnailer by FWR Media
  function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $responsive = true, $bootstrap_css = '') {
   if ( substr($src,strlen('images/'),4) == 'http') {
     if (file_exists ( substr($src,(strlen('images/')))) ){
       $src = substr($src,(strlen('images/')));
     } else {
       $src = 'images/no-image.jpg';
     }
   }
   // Include the Database installation file if executed for the first time.

    if ( !defined('KISSIT_SHARPEN_THUMBNAIL') ) require_once DIR_WS_MODULES . 'kiss_image_thumbnailer/db_install.php';

rgds

Rainer

Share this post


Link to post
Share on other sites

Hi Rainer

What that does shows the 'images/no-image.jpg' file.

I think the following code needs to be replaced with the KissIT code. Would that be right?

     if (file_exists ( substr($src,(strlen('images/')))) ){
       $src = substr($src,(strlen('images/')));

If so then i don't know how to.

Share this post


Link to post
Share on other sites

Hello @CGhoST,

If the image can't be found it will also be replaced by the KISSIT no image.

Could you first check if your modifications works correct with the original tep_image function. Then it should work also with the KISSIT function.

It just modifies the $src variable (image source) which should be the same for both functions.

rgds

Rainer

Share this post


Link to post
Share on other sites

Without KissIT it works fine. But my script loads after the following code:

// The HTML image wrapper function
  function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $responsive = true, $bootstrap_css = '') {
    if ( (empty($src) || ($src == 'images/')) && (IMAGE_REQUIRED == 'false') ) {
      return false;
    }

Which is after the KissIT code.

With the KissIT function it shows the above errors and if i put the code where you told me then no image

Share this post


Link to post
Share on other sites

Hello @CGhoST,

 

Can you give this a try, I checked and it doesn't throw error on my test store, but I can't check the functionality you need:

////
// New HTML image wrapper function modified for KISS Image Thumbnailer by FWR Media
  function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $responsive = true, $bootstrap_css = '') {
    if ( (empty($src) || ($src == 'images/')) && (IMAGE_REQUIRED == 'false') ) {
      return false;
    }
    if ( substr($src,strlen('images/'),4) == 'http') {
     if (file_exists ( substr($src,(strlen('images/')))) ){
       $src = substr($src,(strlen('images/')));
     } else {
       $src = 'images/no-image.jpg';
     }
   }
    // Include the Database installation file if executed for the first time.

    if ( !defined('KISSIT_SHARPEN_THUMBNAIL') ) require_once 'includes/modules/kiss_image_thumbnailer/db_install.php';

 

Share this post


Link to post
Share on other sites

It still shows the no_image file. Even i cant understand why its not working .. and thats the only script that needs to be implemented to enable remote images. There are no other changes.

Share this post


Link to post
Share on other sites

Which add-on is this or is it your custom implementation?

Share this post


Link to post
Share on other sites

@CGhoST,

 

I found this add-on:

Remote and local images

If it's this where you got the code, it's slightly different what is used there from what you posted:

	// check to see if image is external or internal (check for http:) and modify $src
   if ( substr($src,strlen(DIR_WS_IMAGES),4) == 'http') {
       //if (file_exists ( substr($src,(strlen(DIR_WS_IMAGES)))) ){
          $src = substr($src,(strlen(DIR_WS_IMAGES)));
       //} else {
       //   $src = DIR_WS_IMAGES . 'no_img.jpg';
       //}
   }

The check if file exists and the no_img line is uncommented there.

or do you have another source?

 

Edit:

I found this thread with another code version for BS:

https://forums.oscommerce.com/topic/410193-using-images-both-local-and-remote-images-in-osc-bootstrap/#comment-1747498

Meanwhile I still do not understand for what this should be good, could you explain?

Edited by raiwa

Share this post


Link to post
Share on other sites

Its the same. I had it uncommented before installed KissIT .. then after installing KissIT i was getting above errors. Now if i use the script with the IF ELSE statement commented then i get all those errors again.

Also changed DIR_WS_IMAGES ---> 'images/' as BS is hardcoded

I have many suppliers and most have their own images and they update those images on weekly or monthly basis. Rather than having to download all images at regular intervals to my server they have given me permission to link images directly to them. Remote Images contribution does that but with KissIT installed they both break.

Edited by CGhoST

Share this post


Link to post
Share on other sites

@CGhoST,

OK, I understand now better. I would say the problem which appears is due to permission restrictions on the suppliers server. The image path $src points to your suppliers server image directory and KissIt tries to create the directories for the thumbnails there. I would say then it is not possible to use this modification together with KissIt image thumbnailer. You may get it to run with mayor modifications, but this is far beyond the possibilities I have to give support here. You should try to get help in the commercial support thread.

 

rgds

Rainer

Share this post


Link to post
Share on other sites

Hi

I have installed in bs Edge July 2017, as per instructions, all seems fine, however when I get to the final step for installing in admin, the page goes completely blank. When I changed the code back all is well.

Any ideas where I have gone wrong?

Thanks in advance Shaun

6.) catalog/ADMIN/includes/configure.php

NOTE: You need to change permissions for this file to 755 or 777 to be able to change it.
Don’t forget to set permissions back to it’s original value 444 or 400 once you finished editing.

Find these lines

define('DIR_WS_CATALOG_IMAGES', DIR_WS_CATALOG . 'images/');

 Replace with the following:

define('DIR_WS_CATALOG_IMAGES', '../images/');

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×