Forum

Thread tagged as: Problem, Api, Events

Perch Importer: image_assetID images not being imported

Hi, I'm running the latest version of Runway (3.1.1)

I'm trying to import perch_events content into a new collection, and the issue I'm having is that images aren't being assigned. I've seen this reported in a couple of posts around a year ago, but can't find a solution on any of them.

I've followed the docs, and I've been abe to import a load of other content successfully. Just snagged on the assets.

My simplified import is:

$Importer->add_item([
          'title' => $event['eventTitle'],
          'slug' => '',
          'image_assetID' => $event['image']['assetID'],
]);

The template I'm importing into has:

<perch:content id="image" type="image" label="Image" bucket="events">

And the original template I'm importing from has:

<perch:events id="image" type="image" width="640" height="480" label="Image" bucket="events"/>

I wondered if it was to do with the resource being assigned to the events app, but even if I hard code an assetID from a default resource (ie. the resourceApp field in the DB is 'assets') - I still get the issue.

Any help appreciated

Mike

Mike Fallows

Mike Fallows 2 points

  • 3 years ago
Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

Hello Mike,

Try this:

$Importer->add_item([
'title' => $event['eventTitle'],
'slug' => '',
'image' => '',
'image_assetID' => $event['image']['assetID'],
]);

Thanks for the help, Hussein, but the result is just creating an empty reference for the image field. It doesn't seem to be triggering the assets stuff at all.

Hussein Al Hammad

Hussein Al Hammad 105 points
Registered Developer

I ran into the same issue recently and adding 'image' => '', as suggested by Drew here, solved it for me.

Have you checked whether $event['image']['assetID'] contains the asset ID as you expect?

Ah, I realised what was happening. I was running the import locally, but the resources are only on the server, so I think it was silently failing because the resources / bucket folder was not writable / accessible. D'oh!

But... it does also need that empty 'image' => '' field too, good spot - thanks!!