Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

"if" Image Exist In A Folder.. Show It.. ?


zchlomo

Recommended Posts

Hello there.

 

We have just added a folder and a function to the popup_image.php file, which shows a second image in the popup window for detailed images.

 

Here are the codes:

 

<?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); ?>

----- created by us to show the second image: ------

<br><br>

<?php echo tep_image('http://www.beltshop.no/catalog/images/image2/' . $products['products_image'], $products['products_name']); ?>

----------------------------------

 

What we need is a "if" rule, that tells the popup window that if there not is stored a image in the "second image folder", it should not attempt to show it.. something like this:

 

<?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); ?>

 

<br><br>

"if there is a image stored in "image2" folder, show:"

<?php echo tep_image('http://www.beltshop.no/catalog/images/image2/' . $products['products_image'], $products['products_name']); ?>

 

Help anyone..

Link to comment
Share on other sites

Hello there.

 

We have just added a folder and a function to the popup_image.php file, which shows a second image in the popup window for detailed images.

 

Here are the codes:

 

<?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); ?>

----- created by us to show the second image: ------

<br><br>

<?php echo tep_image('http://www.beltshop.no/catalog/images/image2/' . $products['products_image'], $products['products_name']); ?>

----------------------------------

 

What we need is a "if" rule, that tells the popup window that if there not is stored a image in the "second image folder", it should not attempt to show it.. something like this:

 

<?php echo tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name']); ?>

 

<br><br>

"if there is a image stored in "image2" folder, show:"

<?php echo tep_image('http://www.beltshop.no/catalog/images/image2/' . $products['products_image'], $products['products_name']); ?>

 

Help anyone..

 

You might think about using the database to your advantage if you want to do this. You can add another field in the products table that says products_image_2 and holds the location of where the second image is. That way you can do a check like

 

if($product['products_image_2'] == NULL){

--load second image here--

}

 

That's one option anyway. Otherwise you're going to have to test where the second image is and have a million other lines of code and headache to try and do the same thing.

Link to comment
Share on other sites

Hmm.. is there no way around using the database? I'm not good with that at all..

 

What if I make another blank picture wich I tell the script to use if there is not stored a second image with the same name as the first image in the image2 map?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...