Jump to content



Latest News: (loading..)

* * * * * 1 votes

KissIT Image Thumnailer


  • Please log in to reply
105 replies to this topic

#101   thejudge99

thejudge99
  • Members
  • 116 posts
  • Real Name:Julian

Posted 01 May 2013 - 09:04 AM

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

#102   vourlismenos

vourlismenos
  • Members
  • 21 posts
  • Real Name:Dimitris
  • Gender:Male
  • Location:Greece

Posted 08 May 2013 - 08:23 AM

@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

#103   DANMAC

DANMAC
  • Members
  • 12 posts
  • Real Name:dan
  • Gender:Male

Posted 08 May 2013 - 09:09 PM

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

#104   thejudge99

thejudge99
  • Members
  • 116 posts
  • Real Name:Julian

Posted 09 May 2013 - 08:28 PM

the Location of all Images along with whatever dimensions are passed to the function - so no that shouldnt matter

#105   DANMAC

DANMAC
  • Members
  • 12 posts
  • Real Name:dan
  • Gender:Male

Posted 10 May 2013 - 11:34 PM

@thejudge99
Thank You Julian!

#106   Gergely

Gergely
  • Community Team
  • 529 posts
  • Real Name:Gergely Tóth
  • Gender:Male

Posted 17 May 2013 - 05:08 PM

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
Header Footer Content Modules
SCM
v3

and some rewrites :-)