Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Customising ALT in Images Meta Data


Sir Lance

Recommended Posts

Posted

I am wanting to ensure my ALT (alterantive text is used on my pages).

 

The HTML image wrapper function is what is used to format the image as shown below

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

 

I see that tep_output_string($alt) returns nothing. A quick and easy fix, could be to modify the code like

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

 

I have added some text and also passed back the image name. Problem is the image name contains path.

 

I have two questions

 

Q1) If I wanted to pass in the image name, how can I strip of the path information to display the filename only, ie MyPict.jpg ?

 

Q2) Where is the variable $alt set ? Can we store ALT description data against our images in the database somewhere ?

 

 

Sir Lance

Posted

OK - I have found that $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

is working correctly. i didn't look down through the source code long enough

Archived

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

×
×
  • Create New...