Tim.Ford Posted February 15, 2006 Posted February 15, 2006 evening all, I'm trying to make the catergory image on the index.php use no database settings for the height and width. I have looked at the function and i'm passing the width and length as null but it keeps on using the database values. <?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, NULL, NULL); ?> Call this function tep_Image() //// // The HTML image wrapper function function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') { if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) { return false; } // alt is added to the img tag even if it is null to prevent browsers from outputting // the image filename as default $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"'; if (tep_not_null($alt)) { $image .= ' title=" ' . tep_output_string($alt) . ' "'; } if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) { if ($image_size = @getimagesize($src)) { if (empty($width) && tep_not_null($height)) { $ratio = $height / $image_size[1]; $width = $image_size[0] * $ratio; } elseif (tep_not_null($width) && empty($height)) { $ratio = $width / $image_size[0]; $height = $image_size[1] * $ratio; } elseif (empty($width) && empty($height)) { $width = $image_size[0]; $height = $image_size[1]; } } elseif (IMAGE_REQUIRED == 'false') { return false; } } //if (tep_not_null($width) && tep_not_null($height)) { //$image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"'; //} // BEGIN Code Keep Image Proportions if (tep_not_null($width) && tep_not_null($height)) { if (IMAGE_CONSTRAIN_PROPORTIONS == 'true' ) { $image_size = @getimagesize($src); if ($image_size[0] <> 0) { $ratio = $width / $image_size[0]; if ($image_size[1]*$ratio > $height) { $ratio = $height / $image_size[1]; $width = $image_size[0] * $ratio; } else { $height = $image_size[1] * $ratio; } } if (($image_size[0] < $width) && ($image_size[1] < $height)) { $width = $image_size[0]; $height = $image_size[1]; } $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"'; } else { $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"'; } } // END Code Keep Image Proportions if (tep_not_null($parameters)) $image .= ' ' . $parameters; $image .= '>'; return $image; } I'm really just looking to use no dimensions for the category image. Any help would be greatly appreciated. Thanks, Tim
moonstone Posted February 16, 2006 Posted February 16, 2006 Try this... Go to Administration, under Configuration, Images, change Calculate Image Size to false. See if that helps... :blush:
Tim.Ford Posted February 16, 2006 Author Posted February 16, 2006 HI Moonstone, That works but, knackers all my images ;) looking at the function it can take null and if both are null (height, width) i just want it to use the images height and width for the category image. I know where to change it etc but just can't work it out at the moment. any ideas. Thanks, Tim.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.