1

I'm using Feed-Me to import a json file from Instagram. The filenames I get for my images from Instagram are MEGA long. Feed-Me is also changing any _ in the name to a space. I'm looking for a way to rename the images once I import them into an Asset volume.

The Feed-Me docs say that "Not only can you use Asset importing to create/upload image files, you can also use it to update them, changing things like custom fields, titles, or even filenames." But I can't find this setting anywhere. Anyone know if this is possible either with Feed-Me or some other way?

2

The part you're referring to in the docs is when you're importing assets into a volume, not when importing assets as part of entries.

I'm not sure how you have things set up, but you could create a new assets volume for your instagram posts and import to that instead. You can then use the title, or any other bit of data to rename the file (I believe). You could then retrieve all the assets from that volume in your templates: craft.assets.volume('instagram').all()

Failing that you can write a simple module and use a hook to re-name each file on import.

2
  • Thanks for taking the time to answer! This was a huge help. Sometimes it takes another set of eyes to help find the obvious. This got me half way there. With FeedMe you can select a field to rename the images you are saving to a volume, but that field needs to actually be a filename with an extension. I tried using the title (which is the ID of the Instagram post) but was getting errors. I ended up just pulling in all the fields I needed, and then built an RSS feed from the entries - for the title, I pulled in the id, and just appended a ".jpg" and now everything is all well. – gjhead Jun 8 at 22:23
  • 1
    Glad you're sorted! – dmatthams Jun 9 at 8:44

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.