Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can i hard-code image size?


swiftmed

Recommended Posts

Hey guys,

 

could anybody tell me how i can hard-code my main products image size in this following extract of code please? I want to hard-code it because im using a morepics modification, and i want the additional pics to have one size (set by small_image_width) and my main product image another size - which id like to hard code.

 

This is the piece of code which controls the product image from my product_info.php page. could anybody please tell me how to, or change this piece of code for me please?

 

			 <table border="0" cellspacing="0" cellpadding="2" align="center">
		   <tr>
			 <td align="center" class="smallText">
			   <script language="javascript"><!--
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img border=0 src=images/zoom.gif></a>'; ?>');
//--></script>
			   <noscript>
				 <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img border=0 src=images/zoom.gif></a>'; ?>

 

Thanks so much.

Andy

Link to comment
Share on other sites

Never used mopics ... in your code there as you can see SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT is set in your administrator section under configuration ... I guess if you wanted to change these you could do it like so:

 

<?php 
define('NEW_IMAGE_WIDTH', '110');
define('NEW_IMAGE_HEIGHT', '110');
?>

<table border="0" cellspacing="0" cellpadding="2" align="center">
		   <tr>
			 <td align="center" class="smallText">
			   <script language="javascript"><!--
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'?'':NEW_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':NEW_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img border=0 src=images/zoom.gif></a>'; ?>');
//--></script>
			   <noscript>
				 <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], (MOPICS_RESTRICT_PARENT=='false'?'':NEW_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':NEW_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img border=0 src=images/zoom.gif></a>'; ?>

 

As you can see at the top you define your width and height of the new dimensions (for demonstration I have set both new image width and height to 110 ... you can set it to whatever you want)

Link to comment
Share on other sites

Never used mopics ... in your code there as you can see SMALL_IMAGE_WIDTH and SMALL_IMAGE_HEIGHT is set in your administrator section under configuration ... I guess if you wanted to change these you could do it like so:

 

<?php 
define('NEW_IMAGE_WIDTH', '110');
define('NEW_IMAGE_HEIGHT', '110');
?>

<table border="0" cellspacing="0" cellpadding="2" align="center">
		   <tr>
			 <td align="center" class="smallText">
			   <script language="javascript"><!--
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'?'':NEW_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':NEW_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img border=0 src=images/zoom.gif></a>'; ?>');
//--></script>
			   <noscript>
				 <?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], (MOPICS_RESTRICT_PARENT=='false'?'':NEW_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':NEW_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img border=0 src=images/zoom.gif></a>'; ?>

 

As you can see at the top you define your width and height of the new dimensions (for demonstration I have set both new image width and height to 110 ... you can set it to whatever you want)

 

Hi Vals,

 

Thanks so much for your advice, that worked perfectly and acheived exactly the result i was after, so thank you!!

 

Andy

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...