Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to add class to an image?


bearclaws

Recommended Posts

I'd like to add a class to my images so that instead of this:

 

<img src="images/products/product123.gif" border="0" alt="Product 123" title="Product 123" width="100" height="100">

 

...the resulting HTML will look like this:

 

<img src="images/products/product123.gif" border="0" alt="Product 123" title="Product 123" width="100" height="100" class="productimage">

 

Is there an easy way to do this? Can I pass a class value to the tep_image function?

 

I'd like to be able to assign different classes to different images.

 

Any help would be appreciated! Thanks.

Link to comment
Share on other sites

As far as my osC installation is concerned, there is already a class for the image specs in the stylesheet. That's .br Maybe different on yours though.

 

I'm sure you can change the border and such for the product listings and small versions of the thumbnails, but the enlarged thumbnails are direct links to the .jpg / .gif images, so I don't think you can add CSS to those. Also not sure how you'd go about adding different classes to the different images. The only thing I can think of in that regard is to manually go into each image and tweak it how you'd like it. That's probably the easiest way, if not the only way.

 

Hope that helps.

Link to comment
Share on other sites

Thanks. I assumed that you would have to edit the php files directly. Currently I'm wrapping each image call with a <DIV> that has a unique class assigned to it.

 

So I end up with something like this:

<div class="productimage"><img src="images/products/product123.gif" border="0" alt="Product 123" title="Product 123" width="100" height="100"></div>

 

...instead of the more standard (and more effecient) method:

<img src="images/products/product123.gif" border="0" alt="Product 123" title="Product 123" width="100" height="100" class="productimage">

 

I was just wondering if anyone had successfully modified the tep_image function so that it could receive a "class" parameter?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...