Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

No Image display Question


Genius

Recommended Posts

Hi,

 

I have a Question with regards to the images for the products not sure if it has been answered or someone may have a solution..

Basically i know if you do not have and image for a product you will see the Word Array under your product info in the admin section and you do not see the image in your catalog, it just show a box with a small red x on it..

 

In the contributions there is a fix for this, and all you need to do is have a image and rename it Array and it will display your no image picture all that is fine...

 

But my question is If i have a product and i have an image associated with it.. say Product A have ImageA.jpg . So i need to put the imageA.jpg in the images folder, and that picture will show. Right now the tricky part...

 

If I have ProductA with imageA.jpg as the image BUT i do not have the image in the images folder ( for argument sake , i am still designing the picture).. The web site will just show no image picture with the red x Right!

 

If i wanted to say if that imageA.jpg does not exist then it should the blankpic.jpg instead, untill i upload the imageA.jpg then it should change...

 

Not sure if this is possible but i would really appreciate any assistance..

 

many thanks

Link to comment
Share on other sites

Something like this might work: in includes/functions/html_output.php, around lines 66-7, change from

  function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {
   $image = '<img src="' . $src . '" border="0" alt="' . $alt . '"';

to

  function tep_image($src, $alt = '', $width = '', $height = '', $params = '') {
   if (!is_readable($src)) {
     $src = 'no-image-available.jpg';
   }
   $image = '<img src="' . $src . '" border="0" alt="' . $alt . '"';

Hth,

Matt

Link to comment
Share on other sites

That code was from admin/includes/functions/html_output.php. In includes/functions/html_output.php, it would be lines 79-81:

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

change to

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
   if (!is_readable(DIR_FS_CATALOG . 'images/' . $src)) {
    $src = 'no-image-available.jpg';
   }
   $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

or something like that.

 

Hth,

Matt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...