Jump to content
Sign in to follow this  
vdezine

tep_image??

Recommended Posts

This is my image function code from catalog/includes/html_output.php:

How and where would I add the class to this code?

 

////

// The HTML image wrapper function

function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

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

$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 = intval($image_size[0] * $ratio);

} elseif (tep_not_null($width) && empty($height)) {

$ratio = $width / $image_size[0];

$height = intval($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;

}

 

////

 

Thanks!

Share this post


Link to post
Share on other sites

Guessing here because it is late but I think

 

$image .= '>'; there

 

like

 

$image .= ' class="whatever">';

 

 

 

if that doesn't work you could try changing

 

$image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

 

to

 

$image = '<img src="' . tep_output_string($src) . '" class="whatever" border="0" alt="' . tep_output_string($alt) . '"';

Edited by wendyjames

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Share this post


Link to post
Share on other sites

This line:

 

$image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

 

eg.

 

 

$image = '<img src="' . tep_output_string($src) . '" style="border:1px solid black;" alt="' . tep_output_string($alt) . '"';

 

 

Problem with that is, of course, that osCommerce is full of transparent pixels which will now have a border :D

 

 

Sonia

Edited by Xgraphico

If you want to make your dreams come true, the first thing you have to do is wake up

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×