I have a image, for example a\m\amding.jpg and I am replacing image file in database with v/o/void.jpg. How can I move file from a\m\ to \v\o and change her name from amding to void? I want to copy first image from her folder, rename.it, and set to other folder.

  • 1
    I think You are talking about some her and may be that her has a boyfriend – Murtuza Zabuawala Dec 16 '16 at 9:22
  • do you want to replace that image manually or Programatically . – Murtuza Zabuawala Dec 16 '16 at 9:24

You can do it manually. If you want to do it pragmatically we have couple of options

The rename function does this

docs rename

rename('a\m\amding.jpg', 'v/o/void.jpg');

If you want to keep the existing file on the same place you should use copy

docs copy

copy('a\m\amding.jpg', 'v/o/void.jpg');
| improve this answer | |

Ok If you want to move manually then go to

yourMagento_root/media/catalog/product/a/m/amding.jpg copy and move


| improve this answer | |
  • There is a way to make it from code? – ana.coman93 Dec 16 '16 at 9:59
  • I actually want to update a media_gallery image file fileld. – ana.coman93 Dec 16 '16 at 10:02
  • @ana.coman93 explain in more detail what you want to achieve , do you have any csv files from you want to achieve this ? – Murtuza Zabuawala Dec 16 '16 at 10:03
  • No. I have a shell. I want to change all media_gallery images name (image['file']) for one product. For example if I had a image named image.jpg that is saved in i/m/image.jpg....I want to rename it my_product.jpg and automatically save it in m/y/my_product.jpg – ana.coman93 Dec 16 '16 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.