Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HELP! Category Image Size and featured product image size...


mikekingpin

Recommended Posts

Hi Folks!!! I am hoping someone can help me out here!!!

 

I am trying to tweak the amount that my images are scaled down. The product page images, we managed to do (someone found it for me! LoL) - via editing the file: /public_html/templates/theme086/content/product.info.php

 

But...

 

I cannot seem to alter the category images (and sub category) and also the 'featured products' images (both homepage and featured box)

 

The site is an online adult shop (nothing heavy!!!) so I won't post the url here, for fear of breaking terms etc... (altho if its okay to do that, can a mod tell me!?)

 

I did find a file theme086.sql, (template is called theme086.sql) that seemingly has some image size settings, that match the image sizes of the sub categories etc... but when I tweak these, it has no effect!!!

 

Hmmm

 

Anyone?

:-(

 

Thanks in advance!!!

 

Mike

Link to comment
Share on other sites

The category images are displayed in index.php with this code:

 

			<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

You can tweak the size with code something like this:

 

			<td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<?php
//
// Index 0 and 1 contains respectively the width and the height of the image. 
//
 $width_text = HEADING_IMAGE_WIDTH;
 $height_text = HEADING_IMAGE_HEIGHT;
 if ( $image_size = @getimagesize(DIR_WS_IMAGES . $category['categories_image'] ) ) {
$scale_factor = 0.5; // sample scale factor - alter to suit
$width_text = intval( $image_size[0] * $scale_factor );
$height_text = intval( $image_size[1] * $scale_factor );
 }
//
//
?>

		<td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], $width_text, $height_text); ?></td>

Similarly the sub category images in index.php:

 

Old code:

 

	while ($categories = tep_db_fetch_array($categories_query)) {
  $rows++;
  $cPath_new = tep_get_path($categories['categories_id']);
  $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
  echo '				<td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n";
  if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
	echo '			  </tr>' . "\n";
	echo '			  <tr>' . "\n";
  }
}

New code:

 

	while ($categories = tep_db_fetch_array($categories_query)) {
  $rows++;
  $cPath_new = tep_get_path($categories['categories_id']);
  $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%';
//
// Index 0 and 1 contains respectively the width and the height of the image. 
//
  $width_text = SUBCATEGORY_IMAGE_WIDTH;
  $height_text = SUBCATEGORY_IMAGE_HEIGHT;
  if ( $image_size = @getimagesize(DIR_WS_IMAGES . $category['categories_image'] ) ) {
	$scale_factor = 0.5; // sample scale factor - alter to suit
	$width_text = intval( $image_size[0] * $scale_factor );
	$height_text = intval( $image_size[1] * $scale_factor );
  }
//
  echo '				<td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], $width_text, $height_text) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n";
  if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
	echo '			  </tr>' . "\n";
	echo '			  <tr>' . "\n";
  }
}

Code like this lets you just scale the image size directly bypassing the image sizes set in the admin.

 

Always backup before editing.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...