Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do I add a border?


Totally Lost

Recommended Posts

How do I add a border to the "click to enlarge image" next to my items description?

 

...i've tried fiddling with the product_info.php file but I can't seem to figure it out, any takers?

 

Thanks

 

 

   if (tep_not_null($product_info['products_image'])) {
?>
         <table border="0" cellspacing="0" cellpadding="2" align="right">
           <tr>
             <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript: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']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="10" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</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'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="10" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
             </td>
           </tr>
         </table>

Link to comment
Share on other sites

I modified the following function in include/functions/html_output.php to include the possibility of adding a border around the pic, default is no border (false)

 

////
// The HTML image wrapper function
 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $border = false) {
   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

 if ($border == true)	{
  	 $image = '<img src="' . tep_output_string($src) . '" border="1" class="imageborder" alt="' . tep_output_string($alt) . '"';
 } else {
  	 $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;
 }

 

I defined the class for the border in the stylesheet.css:

IMG.imageborder {
 border: solid; border-width: 2px;
 border-color: #9999CC; 
}

 

I changed the code of images from the standard one to this, if I wanted a border:

tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="10" vspace="5"', true)

 

as you can see, I just added the new, 6th parameter, with a true, so a border would show.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

I modified the following function in include/functions/html_output.php to include the possibility of adding a border around the pic, default is no border (false)

 

////
// The HTML image wrapper function
?function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '', $border = false) {
? ?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

?if ($border == true)	{
? ?	$image = '<img src="' . tep_output_string($src) . '" border="1" class="imageborder" alt="' . tep_output_string($alt) . '"';
?} else {
? ?	$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;
?}

 

I defined the class for the border in the stylesheet.css:

IMG.imageborder {
?border: solid; border-width: 2px;
?border-color: #9999CC; 
}

 

I changed the code of images from the standard one to this, if I wanted a border:

tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="10" vspace="5"', true)

 

as you can see, I just added the new, 6th parameter, with a true, so a border would show.

 

Works great!

 

I wonder, can you reccomend a good thumbnail resizer contrib?

Link to comment
Share on other sites

Works great!

 

I wonder, can you reccomend a good thumbnail resizer contrib?

 

there are a few out there ... but I resized mine by hand ... so nope sorry!

 

glad you got the border to work!

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...