OsCommerce Category Image Problem: ‘IMAGE DOES NOT EXIST’
Here is the solution to a minor, but annoying problem I was having with some installations of OsCommerce. When saving an edit for a category, which already had an image file in the database, the image association would be lost and the error ‘IMAGE DOES NOT EXIST’ would be displayed. The workaround was to use the browse field to populate the image field each time you edited a record.
I had searched for the solution a number of times, but came up dry. Recently, however, when researching a contribution that added a text description for a category, I found the solution in the readme file (not available to search engines):
CHANGES TO admin/categories.php
CAREFUL: These are not trivial changes. There is a lot of code here.
1) Locate the following line (approximately line 80) (image update bug repair provided in the bugs section on oscommerce.com):
if ($categories_image = new upload(‘categories_image’, DIR_FS_CATALOG_IMAGES)) {
tep_db_query(“update ” . TABLE_CATEGORIES . ” set categories_image = ‘” . tep_db_input($categories_image->filename) . “‘ where categories_id = ‘” . (int)$categories_id . “‘”);
}REPLACE those 3 lines with the following 5 lines:
$categories_image = new upload(‘categories_image’);
$categories_image->set_destination(DIR_FS_CATALOG_IMAGES);
if ($categories_image->parse() && $categories_image->save()) {
tep_db_query(“update ” . TABLE_CATEGORIES . ” set categories_image = ‘” . tep_db_input($categories_image->filename) . “‘ where categories_id = ‘” . (int)$categories_id . “‘”);
}
The comment says “image update bug repair provided in the bugs section on oscommerce.com,” which I was never able to find.



Thanks! This made a difference for me
Didn’t work for me… what I’m trying to do is add in a Coming Soon image to the blank categories I’ve created. I’ve uploaded the image after creating the new category in the admin section. I see the image there but not in the actual store. Not sure what I’m doing wrong… help please.
If you can see the image in the administration but not in the live shop, it might be an issue with the paths defined in the configuration files. There is a separate file for the live shop and the admin section. I would double check your image paths in both config files to make sure the one for the live site is correct.
The solution mentioned in this post is for the circumstance where you edit a category, and the image that was previously associated with it is lost in both admin and the live site, so this fix is probably not appropriate based on what you are describing.
hi..
I installed the latest version of OsCommerce that had those replacement, but how come it still came up with “IMAGE DOES NOT EXIST”? This is so frustrating.. U_U
Can you give more details? Are you able to see the image initially when you add it to the category, or not at all?
Got the same problem as hk. Really frustrating indeed, tried everything! Map permissions, (admin)configure files checked, even reïnstalled part of the shop, tried an immage contribution from the osCommerce site, no effect, on the server changed settings of Safe-mode and Register Globals. Everything works except the image uploading. Is there a way for manually change php-files?
Thanks!
Hi Joost. If your config files have the right paths, you’ve double-checked your permissions and the fix described in this article is already applied, I’m not sure what else it could be.