Jump to content
FWR Media

KissIT Image Thumnailer

Recommended Posts

try this new function in html_output.php

// New HTML image wrapper function modified for KISS Image Thumbnailer by FWR Media
 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
   // If width and height are not numeric then we can't do anything with it


$imageg = @getimagesize($src);

// Check the input variables and decide what to do:

if($width > $imageg[0] && $height > $imageg[1]){

  $image = '<img src="' . tep_output_string($src) . '" alt="' . tep_output_string($alt) . '"';

  if (tep_not_null($alt)) {
 $image .= ' title=" ' . tep_output_string($alt) . ' "';
  }




 $image .= ' '.$imageg[3];


  if (tep_not_null($parameters)) $image .= ' ' . $parameters;

  $image .= ' />';

  return $image;

}else{

  if ( !is_numeric ( $width ) || !is_numeric ( $height ) ) return tep_image_legacy( $src, $alt, $width, $height, $parameters );
  require_once DIR_WS_MODULES . 'kiss_image_thumbnailer/classes/Image_Helper.php';
  $attributes = array( 'alt' => $alt, 'width' => $width, 'height' => $height );
  $image = new Image_Helper( array( 'src'				   => $src,
		 'attributes'		    => $attributes,
		 'parameters'		    => $parameters,
		 'default_missing_image' => DIR_WS_IMAGES . 'no_image_available_150_150.gif',
		 'isXhtml'			   => true,
		 'thumbs_dir_path'	   => DIR_WS_MODULES . 'kiss_image_thumbnailer/thumbs/',
		 'thumb_quality'		 => 75,
		 'thumb_background_rgb' => array( 'red'   => 255,
				  'green' => 255,
				  'blue'  => 255 ) ) );
  if ( false === $image_assembled = $image->assemble() ) {
 return tep_image_legacy( $src, $alt, $width, $height, $parameters );
  }
  return $image_assembled;
}
 } // end function

it checks first the Image dimensions with the original - if both width and height are bigger - it will instead just link the original Image

Share this post


Link to post
Share on other sites

@@14steve14 unfortunately I have to be able to cope with two different dimensions. It's just not possible to rely only on one, and it will also save a lot of time later on, because we won't have to edit the images.

 

@@thejudge99 this could be it. I'll try it and get back to you. Thanks

Share this post


Link to post
Share on other sites

Hello

 

If the images are not in the default folder "images" but in "images/products" will I need to change any code in KissIT Thumbnailer?

 

 

Thank You

Share this post


Link to post
Share on other sites

Hi,

 

maybe this function would be usefull for reset or clean thumbs cache at admin -> Configure -> Images

 

Run in phpMyadmin (mySql):

INSERT INTO `configuration` (`configuration_title`, `configuration_key`, `configuration_value`, `configuration_description`, `configuration_group_id`, `sort_order`, `last_modified`, `date_added`, `use_function`, `set_function`) VALUES
('Reset thumbs', 'RESET_IMAGE_THUMBS', 'false', 'Reset thumbs cache', 4, 9, '2013-02-20 19:36:26', '2013-01-29 17:11:10', 'tep_cfg_reset_thumbs_cache', 'tep_cfg_select_option(array(''reset'', ''false''),');

 

 

add this hard coded function into admin/includes/functions/general.php

 function tep_cfg_reset_thumbs_cache( $action = 'false' ) {
   if ($action == 'reset' ) {
  $mask = "../includes/modules/kiss_image_thumbnailer/thumbs/*.jpg";
  array_map( "unlink", glob( $mask ) );
  $mask = "../includes/modules/kiss_image_thumbnailer/thumbs/*.gif";
  array_map( "unlink", glob( $mask ) );
  $mask = "../includes/modules/kiss_image_thumbnailer/thumbs/*.png";
  array_map( "unlink", glob( $mask ) );
  tep_db_query( "UPDATE " . TABLE_CONFIGURATION . " SET configuration_value='false' WHERE configuration_key='RESET_IMAGE_THUMBS'" );
   }
 }

 

;)

Regards,

Gergely


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

It seems that I had missed the extra part in the installation about the product_info file for oscommerce 2.3.x

Sorry for wasting your time, and thank you for wasting it :)

Share this post


Link to post
Share on other sites

@@FWR Media

Can you confirm @@Gergely suggested cache fix. I woudl like to implement this with the support of the creator of this addon.

Would this be included in the next update of this addon?

Share this post


Link to post
Share on other sites

Hi,

 

maybe this function would be usefull for reset or clean thumbs cache at admin -> Configure -> Images

 

Yes there really should be a way to clear the thumbs via admin.

Share this post


Link to post
Share on other sites

once this is installed, does it automatically update any existing images already uploaded for products?

 

ie, the existing default products that are in the fresh install, or would it start working from when you upload your pictures after installation?

 

also, does this alter the existing layout for product info and its images?

 

not sure whether i need another plugin to create a nice layout for the images.

 

im thinking of something like this? big picture and small pictures on right.

 

http://www.shoprevolution.com/fred-perry-silk-tie-belt/

 

thanks

Edited by vampirehunter

Share this post


Link to post
Share on other sites

once this is installed, does it automatically update any existing images already uploaded for products?

 

ie, the existing default products that are in the fresh install, or would it start working from when you upload your pictures after installation?

 

As they are being viewed. Meaning right after install take a look at the thumbs folder and it's probably empty, then go view one of your products and revisit the thumbs folder, you'll see the thumbs have been generated for that products images. This occurs for existing images and future uploaded images.

 

also, does this alter the existing layout for product info and its images?

 

Same layout, just thumbed.

 


I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Share this post


Link to post
Share on other sites

 

thanks

 

would any of you guys have any tips on what to do to modify the default image gallery layout to something like this?

 

im trying to find any tutorials /guidelines for css/html that can help achieve this layout.

 

kind of like the smaller thumbnails can be scrolled across or something similar?

 

this site the thumbnails are going left to right, and you can scroll across.

http://www.truffleshuffle.co.uk/store/mens-black-superman-vision-tshirt-p-11832.html

 

this site, thumbnail are on the right hand side of the main picture, and go downwards.

http://www.shoprevolution.com/chicken-or-egg-shopper/

 

 

I guess the scrolling option would be better as some products might need many multiple images.

 

If i can sort out the layout like the ones above, it would be great in conjunction with this plugin.

Edited by vampirehunter

Share this post


Link to post
Share on other sites

@@FWR Media

 

Hi Robert, thank you very much for this wonderful contribution. I'm testing this now in my new 2.3 store and noticed a small issue. This may be me... and not your contribution....

 

When the length of my image file names is... for example canon_digital_ixus_800_is_1.png... it not display on the product listing (I have not yet installed in the product info). When I shorten file name to MODEL01.png for example, this image displays fine...

 

Is there a functions in one of your files that can be changed to allow for a longer file name?

 

Also when the image is not displayed because of this issue there is not "no image available" image in its place. Just blank...

 

Thank you very much in advance...

 

 

Share this post


Link to post
Share on other sites

hi, i installed the plugin, works perfect!

 

 

 

For the main images (the full size ones in the image folder)

 

i was wondering, is there any way to have the actual Main full size images renamed when uploaded to something more random or specific for each product?

 

for example, if my file name is picture1.jpg

 

whats the best way to change it so that when it uploads, it will be given a more appropriate or maybe random name according to the product id its being uploaded for?

Edited by vampirehunter

Share this post


Link to post
Share on other sites

Hi Robert,

 

somehow found this:

  if ( false !== $parameters ) $this->html .= ' ' . tep_output_string( $parameters );

 

changed to:

  if ( false !== $parameters ) $this->_html .= ' ' . tep_output_string( $parameters );

 

Regards

Gergely


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Hi Robert,

 

somehow found this:

 if ( false !== $parameters ) $this->html .= ' ' . tep_output_string( $parameters );

 

changed to:

 if ( false !== $parameters ) $this->_html .= ' ' . tep_output_string( $parameters );

 

Regards

Gergely

 

is this a fix for something?

Share this post


Link to post
Share on other sites

is this a fix for something?

 

Dear @@vampirehunter,

 

yes it is. This slide out given parameters to "_html" string and not throwing errors. The "html" is not exist in the class.

 

(Image_Helper.php)

Edited by Gergely
given file association

:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Dear @@vampirehunter,

 

yes it is. This slide out given parameters to "_html" string and not throwing errors. The "html" is not exist in the class.

 

(Image_Helper.php)

 

so is _html the correct one or just html?

 

i looked at mine, and its _html.

 

should i change it?

Share this post


Link to post
Share on other sites

how do i make sure that if item has no image, that i can show the "no image available" thumbnail in the shopping cart?

 

as of now, if items have image, they show, but if no image, then just get the product name.

Edited by vampirehunter

Share this post


Link to post
Share on other sites

what i meant was in the shopping cart, if my product has no image, no image shows, just product name.

 

i was wondering how i can implement the no image thumbnail into the shopping cart so it will show?

Share this post


Link to post
Share on other sites

i find this code for functions/html_output.php

 

seems to work but is this the proper way of doing it in conjunction with the kissit thumbnailer?

 

if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
 $src=DIR_WS_IMAGES.'noimage.gif';
}

//for what`s the url like :'images/aa/'
if(!file_exists($src)||strlen(strstr($src,"."))<=0){
$src=DIR_WS_IMAGES.'noimage.gif';
}

Edited by vampirehunter

Share this post


Link to post
Share on other sites

Dear @@vampirehunter,

 

yes it is. This slide out given parameters to "_html" string and not throwing errors. The "html" is not exist in the class.

 

(Image_Helper.php)

 

Hi

when i checked my file, the change was already done.

which version are you using??

 

is _html the correct one or just html?

thanks

Share this post


Link to post
Share on other sites

which version are you using??

 

I think this was an older...

 

You could see some new features here


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

Hello @@FWR Media

 

I just installed this mod and it works great. Except on the index page where broken images are displayed. Please tell me what settings in admin I need to check or any code in the index page.

 

I use OSC 2.3.3

 

Thanks

Edited by discxpress

Share this post


Link to post
Share on other sites

does anyone have any tips on displaying a custom image when a product has no images uploaded?

 

specifically for the product info page.

 

I've managed to get a "no image" displayed on the product listings page and the shopping cart page, but not the product info page.

 

if a product has no images, then on the product info page, nothing is shown.

Edited by vampirehunter

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

×