Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

change location of catalog images


unimpressed

Recommended Posts

Posted

how can I change the location of the product images? I don't want all my images in the images folder (along with all the other images used by osCommerece)

I want to put images in images/product_images

 

I've tried changing DIR_WS_CATALOG_IMAGES in admin/configure.php, but this doesn't work.

Posted

You could try editing the database insert on the categories page to send the appended file path to the database.

Page:admin/categories.php Line:227

 

if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

$sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);

 

You would need to do a string insert, such as:

if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

$new_image_path = 'product_images/' . $HTTP_POST_VARS['products_image'];

}

$sql_data_array['products_image'] = tep_db_prepare_input($new_image_path);

 

I dont know if this will work - or what other problems you may encounter - but it should work..

Lloyd

Posted

You were doing it the correct way. Try it again and look in your browser. In Firefox right click on the image and do a "Copy Image Location" to see what the path to your images is. You might have to add or remove a slash / or something.

 

how can I change the location of the product images? I don't want all my images in the images folder (along with all the other images used by osCommerece)

I want to put images in images/product_images

 

I've tried changing DIR_WS_CATALOG_IMAGES in admin/configure.php, but this doesn't work.

Shade and Sweet Water

Chris Czerniak

Posted

thanks for the replies.

 

sorted it now.

 

first, I added yet another constant to admin/configure.php

 

define('DIR_WS_IMAGE_PREFIX','product_images/');

 

then I modified line 227 in admin/categories.php to

 

$sql_data_array['products_image'] = DIR_WS_IMAGE_PREFIX . tep_db_prepare_input($HTTP_POST_VARS['products_image']);

 

I also had to change line 995 to

 

$contents[] = array('text' => '<br>' . tep_image(DIR_WS_CATALOG_IMAGES . $pInfo->products_image, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $pInfo->products_image);

Archived

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

×
×
  • Create New...