Trusten Posted February 11, 2003 Share Posted February 11, 2003 http://www.oscommerce.com/community/contributions,963 Often times, if you have an old image on the shop, and you upload a new one that has the same name, osc will overwrite the image. We can't always remember the names of all of our images. this little feature will simply put a time stamp on it. All images will have a different date on it, it won't repeat. it saves up to the very second. instead of pic1.jpg it reads M-D-T-pic1.jpg M-D-T (month day time) Many thanks to Galen who took the hour out to help me figure out why it wouldn't work. I owe him coffee.... Trusten.... here is the code In: catalog/admin/categories.php Find: // copy image only if modified $products_image = tep_get_uploaded_file('products_image'); $image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES); if (is_uploaded_file($products_image['tmp_name'])) { tep_copy_uploaded_file($products_image, $image_directory); $products_image_name = $products_image['name']; Replace with: // copy image only if modified $products_image = tep_get_uploaded_file('products_image'); // we have an incoming file (temp.zip) in $file // create stamp $now = date("m-d-Y_H.i.s"); // merge $stamped_file = $now . '-' . $products_image['name']; $products_image['name'] = $stamped_file; $image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES); if (is_uploaded_file($products_image['tmp_name'])) { tep_copy_uploaded_file($products_image, $image_directory); $products_image_name = $products_image['name']; Thanks to galen for figuring out what was wrong with the code. Have fun. Quote Link to comment Share on other sites More sharing options...
mattice Posted February 11, 2003 Share Posted February 11, 2003 // we have an incoming file (temp.zip) in $file // create stamp $now = date("m-d-Y_H.i.s"); // merge $stamped_file = $now . '-' . $products_image['name']; Dejavu.... ;) Mattice Quote "Politics is the art of preventing people from taking part in affairs which properly concern them" Link to comment Share on other sites More sharing options...
Trusten Posted February 11, 2003 Author Share Posted February 11, 2003 yeah, i know. but i figured it'd be easy for me to keep track of it later. :( but i forgot to say thanks :) to mattice for first giving me the blue print to go by. rock on dutch man *hands Mattice chocolate* Quote Link to comment Share on other sites More sharing options...
daveherbert Posted June 26, 2004 Share Posted June 26, 2004 Hi Trusten, Have you any ideas how to make your image timestamp contribution work with oscommerce ms2. I had no problem with ms1 but cant make it work with ms2. I think the image upload function has change in ms2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.