uadrajunk Posted November 22, 2007 Share Posted November 22, 2007 It is possible to define subdirectories for product images - but so far only manually when editing the products.products_image field value (which is why there are products in subdirectories as standard). There is no way to do it in the Administration Tool though and is a current limitation that will be fixed in the next release. Here are some code changes for admin/categories.php that will allow you to define a subdirectory. It is untested though should work if my mighty powers still function at 3AM in the morning correctly, and hope someone can spice it up and forward it to the Tips and Tricks forum channel :) Line 315, change from: $products_image->set_destination(DIR_FS_CATALOG_IMAGES); to: $products_image->set_destination(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_image_destination']); Line 317, change from: $products_image_name = $products_image->filename; to: $products_image_name = $HTTP_POST_VARS['products_image_destination'] . $products_image->filename; After lines 562-565, add: � � � � �<tr> � � � � � �<td class="main">Image Destination Directory</td> � � � � � �<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . DIR_FS_CATALOG_IMAGES . tep_draw_input_field('products_image_destination'); ?></td> � � � � �</tr> Please note that this is only for uploading new images, not for defining existing images, and that the directory must be writeable (there is no error checking here for the subcategory). The subdirectory value must also end with a / Hope that helps! [Edited post to reflect line 317] I have no idea how to add the subdirectories. My Image uploading page in admin, looks the same :'( Can someone help me please.... im stuck with image uploading. Many thanks in advance. Link to comment Share on other sites More sharing options...
KGB Music Posted February 22, 2008 Share Posted February 22, 2008 I'm trying this code and the resulting path has two backslashes before the images folder: path//images/ Any ideas where I can fix this? Hi, pretty new to this so not sure exactly how the forum works but managed to get images uploading to sub directory. admin/includes/configure.php has two forward slashes on line 10: 'DIR_FS_CATALOG', 'C:/wamp/www/catalog//' also two slashes on line 6: 'C:/wamp/www/catalog//' and line 8: 'C:/wamp/www/catalog//admin/' got rid of these and images uploading fine, need to define sub-directory in new text box followed by forward slash / Regards, Keith. Link to comment Share on other sites More sharing options...
sheva99 Posted October 18, 2009 Share Posted October 18, 2009 It is possible to define subdirectories for product images - but so far only manually when editing the products.products_image field value (which is why there are products in subdirectories as standard). There is no way to do it in the Administration Tool though and is a current limitation that will be fixed in the next release. Here are some code changes for admin/categories.php that will allow you to define a subdirectory. It is untested though should work if my mighty powers still function at 3AM in the morning correctly, and hope someone can spice it up and forward it to the Tips and Tricks forum channel :) Line 315, change from: $products_image->set_destination(DIR_FS_CATALOG_IMAGES); to: $products_image->set_destination(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['products_image_destination']); Line 317, change from: $products_image_name = $products_image->filename; to: $products_image_name = $HTTP_POST_VARS['products_image_destination'] . $products_image->filename; After lines 562-565, add: ? ? ? ? ?<tr> ? ? ? ? ? ?<td class="main">Image Destination Directory</td> ? ? ? ? ? ?<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . DIR_FS_CATALOG_IMAGES . tep_draw_input_field('products_image_destination'); ?></td> ? ? ? ? ?</tr> Please note that this is only for uploading new images, not for defining existing images, and that the directory must be writeable (there is no error checking here for the subcategory). The subdirectory value must also end with a / Hope that helps! [Edited post to reflect line 317] This edit is not working, can you please explain why it might not? Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.