Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

function tep_draw_separator faulty


osjunkie

Recommended Posts

Hi,

 

My seperator seems not to be working. All I get drawn is 1 pixel and the width seems not to work.

 

html_output.php

////
// Output a separator either through whitespace, or with an image
function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
  	 return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);
  }

 

In the page it is as...

<td width="100%"><?php echo tep_draw_separator('pixel_black.gif', '100%', '1'); ?></td>

 

Any reason why I just a dot and not a line?

Link to comment
Share on other sites

Hi,

 

My seperator seems not to be working. All I get drawn is 1 pixel and the width seems not to work.

 

html_output.php

////
// Output a separator either through whitespace, or with an image
function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
? ?	return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);
? }

 

In the page it is as...

<td width="100%"><?php echo tep_draw_separator('pixel_black.gif', '100%', '1'); ?></td>

 

Any reason why I just a dot and not a line?

 

try putting a <br> behind it:

 

 

<td width="100%"><?php echo tep_draw_separator('pixel_black.gif', '100%', '1'); ?><br></td>

Treasurer MFC

Link to comment
Share on other sites

try putting a <br> behind it:

<td width="100%"><?php echo tep_draw_separator('pixel_black.gif', '100%', '1'); ?><br></td>

 

 

I found the reason why. Thanks for the reply!

 

It was Image Magic was resizing the pictures to proper proportions and wasn't allowing the line to be drawn.

 

I ended up making a new tep_image_seperator function from the stock tep_image code that is modified by the image resize contribution and it works perfectly.

 

 

Thanks,

 

Brad

Link to comment
Share on other sites

  • 9 months later...
I found the reason why. Thanks for the reply!

 

It was Image Magic was resizing the pictures to proper proportions and wasn't allowing the line to be drawn.

 

I ended up making a new tep_image_seperator function from the stock tep_image code that is modified by the image resize contribution and it works perfectly.

Thanks,

 

Brad

can you post your new code? i have the same problem!

 

thanks!

Matthias Thoen

my contribution: Photo Gallery for osCommerce

--check my homepage in my CARD--

Link to comment
Share on other sites

  • 7 months later...
  • 1 month later...
I wanna know too... !!!

 

For those who still need an answer to this I found a solution on this forum.

 

It seems that image magic was indead messing with the tep_draw_separator function. The solution, as mentioned above, is to clone the function as follows:

 

catalog/includes/functions/html_output.php

 

find:

////
// Output a separator either through whitespace, or with an image
 function tep_draw_separator($image = 'pixel_black.gif', $width = '100%', $height = '1') {
return tep_image(DIR_WS_IMAGES . $image, '', $width, $height);
 }

replace with:

////tep_draw_seperator fix start
// The HTML image wrapper function mk2 added to get around the constrain image proportion mod
function tep_image2($src, $alt = '', $width = '', $height = '', $parameters = '') {
  if ( (($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
  $image2 = '<img src="' . tep_parse_input_field_data($src, array('"' => '"')) . '" border="0" alt="' . tep_parse_input_field_data($alt, array('"' => '"')) . '"';

  if (tep_not_null($alt)) {
 $image2 .= ' title=" ' . tep_parse_input_field_data($alt, array('"' => '"')) . ' "';
  }

  if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && ((!$width) || (!$height)) ) {
 if ($image_size = @getimagesize($src)) {
   if ( (!$width) && ($height) ) {
	 $ratio = $height / $image_size[1];
	 $width = $image_size[0] * $ratio;
   } elseif ( ($width) && (!$height) ) {
	 $ratio = $width / $image_size[0];
	 $height = $image_size[1] * $ratio;
   } elseif ( (!$width) && (!$height) ) {
	 $width = $image_size[0];
	 $height = $image_size[1];
   }

 } elseif (IMAGE_REQUIRED == 'false') {
   return false;
 }
  }

  if ( ($width) && ($height) ) {
 $image2 .= ' width="' . tep_parse_input_field_data($width, array('"' => '"')) . '" height="' . tep_parse_input_field_data($height, array('"' => '"')) . '"';
  }

  if (tep_not_null($parameters)) $image .= ' ' . $parameters;
  $image2 .= '>';
  return $image2;
}

////
// Output a separator either through whitespace, or with an image
function tep_draw_separator($image2 = 'pixel_black.gif', $width = '100%', $height = '1') {
  return tep_image2(DIR_WS_IMAGES . $image2, '', $width, $height);
}

//tep_draw_seperator fix end

 

I tried it and it works perfectly with image magic installed. All credit and many thanks to tobz for finding this fix.

 

I love this place!

 

Psy

Link to comment
Share on other sites

  • 3 years later...

For those who still need an answer to this I found a solution on this forum.

 

...

 

Just wanted to say thanks for the fix - mine was broken by the 'additional images' contribution. :)

 

Chris

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...