0

How do I use regex for something like this entered in media_gallery column?

http://www.example.com/images/1012a.jpg;http://www.example.com/images/1012b.jpg so that images are saved as "brand-1012a.jpg" and "brand-1012b.jpg" respectively?

  • we haven't tried anything as we're really not sure what to try since there are multiple images names in the same cell. any suggestions would really be welcomed – studiolx Oct 10 '13 at 18:36
  • Are you sure you mean regex? Where are `1012b` and `1012a` coming from? - What data source are these strings provided in? – Axel Oct 10 '13 at 20:04
  • 1012b.jpg and 1012a.jpg are specific remote file names...so we have remote image URLs such as http://www.example.com/images/1012b.jpg ...how do we use regex expression on magmi so that http://www.example.com/images/1012b.jpg saves as brand-1012b.jpg and http://www.example.com/images/1012a.jpg saves as brand-1012a.jpg? – studiolx Oct 10 '13 at 21:10
  • You're talking about renaming the images on the fly, which Magmi does not do. Magmi was designed to map existing data to Magento's database, not really modify it on the fly. You'd have to write a simple Magmi plugin to do what you're trying to achieve. Essentially parse the image file names, download the image and save it with the renamed value. – Axel Oct 10 '13 at 22:59
  • well, actually magmi does rename the files. when we imported main images (images, thumbs) we have used {item.sku}.jpg expression in image renaming field of image attributes processor utility. problem is...we're not sure which regex expression to use to rename images in media_gallery field of our csv file since there are multiple files names here. all we want to do is attach a prefix to the file name such as 1012a.jpg. So, in essence replace "http://www.example.com/images" with "brand-" so that file name becomes "brand-1012a.jpg" – studiolx Oct 11 '13 at 13:52
  • My apologies. I wasn't aware that Magmi included image renaming techniques. I'm not sure if it's available to use on the media_gallery column containing multiple images because the media_gallery column is a list of images. – Axel Oct 11 '13 at 15:42
  • Magmi Official documentation : http://wiki.magmi.org/index.php?title=Image_attributes_processor#Syntax_for_image_renaming – DependencyHell Feb 01 '19 at 14:06

0 Answers0