Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product Image size on home page


Shrewd

Recommended Posts

Home page is showing the actual image size and not the resized one. This is shiffing everything to the right. I deleted the item and created another one. Same thing. This is under box "New Products for November" item can be seen at www.tammr.com

 

Thank you,

 

Ahmad

Link to comment
Share on other sites

in catelog/includes/modules/new_products.php make sure you have all the parameters in this line

										   'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

here is the default osCommerce code

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 new contentBoxHeading($info_box_contents);

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);
 }

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) {
$new_products['products_name'] = tep_get_products_name($new_products['products_id']);
$info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" width="33%" valign="top"',
									   'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}
 }

 new contentBox($info_box_contents);
?>

My Contributions

 

Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

Okay so I added SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT and that took care of it, Kinda. Now the new images are 110 x 82 or 110 x 20 while all the old images were 110x 110. Again this is only in the new_products.php file. The rest of the site show the images as 110 x 110.

Link to comment
Share on other sites

This is what i have for that section.

 

<tr>
<td valign="top" width="1" bgcolor="#CFCFCF"></td>
<td align="center" class="t5 z1"><a href="<?=tep_href_link

('product_info.php?products_id='.$new_products['products_id'])?>"><?=tep_image(DIR_WS_IMAGES.$new_products['products_image'],SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT)?></a><br><?=$new_products['products_name']?><br>

price: <strong><?=$new_products['products_price']?></strong><br><br style="line-height:11px ">
								<a href="<?=tep_href_link('product_info.php?products_id='.$new_products['products_id'])?>"><?=tep_image_button("1_k2.gif");?></a><img alt="" 

src="images/spacer.gif" width="3px" height="1px"><a href="<?=tep_href_link("products_new.php","action=buy_now&products_id=".$new_products['products_id'])?

>"><?=tep_image_button("1_k3.gif");?></a> </td>

<td valign="top" width="1" bgcolor="#CFCFCF"></td>

</tr>

Link to comment
Share on other sites

I tried that and the image went back to orginal size which is 640 x 480. I am trying to make all images on the new_products.php the same size. Which is Small_Image_Width = 110 and Small_Image_Height = 110.

 

Any more Ideas?

Link to comment
Share on other sites

fix the image resize problem?

couse rearanging proportions is not optimal either.

if you change line 88 in includes/functions/html_output.php from:

	  if ($image_size = @getimagesize($src)) {

to

	  if ($image_size = getimagesize($src)) {

and reset it to automaticaly calculate image sizes, you will probably get to see an error on why the auto calculate does not work.

with that error we might get further

Link to comment
Share on other sites

This is the code I have for that file.

// 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) . '"';
}

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

$image .= '>';

return $image;
 }

////

 

Am I missing anything?

Link to comment
Share on other sites

I found something interesting

 

Under Administration> Configuration> Images>

 

Small Image Height = changes the images width and

Small Image Width = Does Nothing.

 

 

Which file should I check for these settings?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...