Issue with image fields

Hi,

To start off, I’m running SuiteCRM version 7.5.3 and Sugar Version 6.5.23 (Build 1061).

I’m having some trouble with image fields and I’m unsure why.

I created an image field and added my folder “Products” to the htdocs directory. When I went into a product in edit view, and then pressed the button to select an image, I navigated to the “Products” folder in htdocs and selected my file. This image did not display and clicking on it took me to localhost/uploads/imagename.jpg which threw a 403 error. A copy of the image called “imagename.jpg” was also made in the upload folder.

To solve this, I checked in the MySQL database and the image was being stored under “/uploads/imagename.jpg” so I simply switched it over to /Products/imagename.jpg from the database. Problem solved and this worked with various other products.

Since I have thousands of products to select images for, I decided to do it via csv so I could easily copy the filepath through its relevant products.

Once I imported this, the functionality of the image field seems to have changed and I am unsure which part of the import process has caused this. Now the images were not displaying. Not only this but rather than “imagename.jpg” copies being made to the uploads folder, there is now a new “file” for each picture for each product in the “uploads” folder called “X_item_image_c” where X is a number, incrementing for each image meaning I have thousands of these copies rather than just 1 image which is used for several products. Furthermore, the database entry is now stored simply as “imagename.jpg” rather than containing the “/uploads/imagename.jpg” path. Now when I go into edit products and click on the picture, rather than open a tab with localhost/uploads/imagename.jpg, it simply downloads the file to the downloads folder.

Deleting the file from “Products” file has no effect. For example if I have “business card.jpg” in the Products folder, the product image in the edit view will be “business card.jpg”, this will also be what is stored in the database. If I delete this file from “Products”, nothing happens. If however I delete the “X_item_image_c” file which corresponds to the image and then clear cache, the picture disappears. In edit view, the image name will still say “business card.jpg” but it cannot be removed unless I go into the database and make the value null so I can then change the picture in edit view again.

Does anyone have any idea why importing in CSV may have caused this? I did not touch any files nor the database between it working and importing the CSV which all worked fine with a limited number of tests but not when every product had an image.

Thanks for any help.