PDA

View Full Version : help with copying images


sharon
10th February 2008, 05:29 PM
I hope I can explain this well enough that someone can help....(this is adding images to products) Adding images 1 by 1 is very painful.

(1) add the image to the first product in the store
(2) then go out and open the database
(3) go to where this product is in "imageovertext"....
copy
(4) highlight the rows you are wanting this image to be copied to, (some of our products have the same image)
(5) then paste this image to the highlight rows

I have worked in the database finding old images and replacing with new ones, but I can't work out how to do this.

Thanks for any help offered.

www.kitcheninabox.com.au

dferguson
11th February 2008, 11:06 AM
Hi Sharon

Im not sure what your question here is but I think your asking how to do a find and replace in MS Access.

To do a find and replace you need to do the following..

1. open the database in acccess.
2. open the products table
3. Select the entire 'ImageFile' column (Or ImageOverText column)
4. Right click and select Find.
5. Goto the Replace Tab.
6. Change the 'Match' option to 'Any Part of Field'
7. Type in the text you want to find (the complete image path/name example: c:\images\image.jpg)
8. Type in what you want to replace it with. Example: c:\images\anotherimage.jpg
9. Click Find Next and then you can replace one by one.

See example Screen Shots:

http://forums.ezimerchant.com/forumcontentimages/findreplaceaccess1.png

http://forums.ezimerchant.com/forumcontentimages/findreplaceaccess.png

sharon
12th February 2008, 09:51 AM
I need that first line copied down into the empty ones, without having to do it one by one
http://forums.ezimerchant.com/images/ezimerchant3/misc/progress.gif

dferguson
12th February 2008, 10:22 AM
You will need to run a SQL command to update the empty fields

This is the SQL command:

Small Images:
update products set ImageFile = 'c:\images\imagename.jpg' where ImageFile = '' or ImageFile is null

Large Images:
update products set ImageOverText = 'c:\images\imagename.jpg' where ImageOverText = '' or ImageOverText is null

Replace the c:\images\imagename.jpg with the correct image path/name.

To get to SQL mode do the following:

http://forums.ezimerchant.com/forumcontentimages/access1.png

Then:

http://forums.ezimerchant.com/forumcontentimages/access2.png

Then paste in the SQL command:

http://forums.ezimerchant.com/forumcontentimages/access3.png

Then run the command:

http://forums.ezimerchant.com/forumcontentimages/access4.png

Now confirm the action:

http://forums.ezimerchant.com/forumcontentimages/access5.png

You can now look in the products table and it should be updated.

Repeat for the large images.

sharon
12th February 2008, 04:08 PM
David would this mean all the rows that are empty be filled with this image?
because I only want to copy the image into certain empty rows

dferguson
12th February 2008, 09:50 PM
Yes, any row that is empty will be filled in.

sharon
13th February 2008, 11:38 AM
in that case, is there a way of copying images to just selected rows

aschiller
14th February 2008, 09:18 PM
It is possible to limit the products against which the image would be applied by specifying extra conditions. For example, if you wanted to only apply it to products which are assigned to Category ID 1 you could change the query to be:

update products set ImageFile = 'c:\images\imagename.jpg' where (ImageFile = '' or ImageFile is null) and ProductID in (select intProductID from CategoryProductMM where intCategoryID = 1)

I should stress though that this is quite an extreme workaround which should only be attempted after a backup of the database has been done. Unless there are common conditions that determine which products share an image, this approach is not suitable. If you can specify the condition, I would be happy to provide example code.