Zen Cart Logo
Forums / General Questions / If Image is not Found Display no_image.gif

If Image is not Found Display no_image.gif

Locked

Views: 1,895

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
19 Jun 2008, 1:59 PM
#1
prosam avatar

prosam

Zen Follower

Join Date:
Jun 2004
Posts:
118
Plugin Contributions:
0

If Image is not Found Display no_image.gif

I'm importing over 8,000 products into my site via an excel file and even though most product images will be named according to their product number I'm sure there will be some that do not get named correctly or are not found at all so I would like the no_image gif to show up instead of a broken image.

I know there has to be a modification done to the image_function file I'm just not sure how, I'm not much of a php coder, I can understand it but cannot write it. Something like if image not found display no_image.gif

Can anyone help, please?

19 Jun 2008, 4:04 PM
#2
prosam avatar

prosam

Zen Follower

Join Date:
Jun 2004
Posts:
118
Plugin Contributions:
0

Re: If Image is not Found Display no_image.gif

Ok I found the answer to my question and here it is if anybody else needs it. This worked in ZC 1.3.8 not sure about the older or newer versions coming out.

In includes/functions/html_output.php after

//auto replace with defined missing image
    if ($src == DIR_WS_IMAGES and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
      $src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
    }

Enter the following:

	if (!file_exists($src)) {
      $src = DIR_WS_IMAGES . PRODUCTS_IMAGE_NO_IMAGE;
	}

This will replace any broken product images with the no image file.

7 Nov 2008, 8:37 PM
#3
prosam avatar

prosam

Zen Follower

Join Date:
Jun 2004
Posts:
118
Plugin Contributions:
0

Re: If Image is not Found Display no_image.gif

UPDATE: The above instructions work but I had not realized there are 2 instances of the original lines of code so just make sure add the snippet after the second instance of the code (line 191 on my file).