Multiple Images

Johnathan E. asked 7 years ago

I'm using the external images plugin with WP All Import for WooCommerce and I'm wanting to set multiple sources for the images. The problem is the remote source uses two different products numbers for the image name at times from two different fields in the CSV. I need to be able to make the plugin use the one that isn't going into a 404. Is it possible to get around this somehow? Thanks!

1 Answers
Dave Hilditch Staff answered 7 years ago

Yes – you can use the getimagesize PHP function to check if the remote image exists.

In your WP All Import, you should create a custom PHP function, then enter the function in the place where you would normally have the image – the external_image_url custom meta I presume. Pass the two image URLs as parameters.

Then inside the function, use the getimagesize function to check if image1 exists, if it does, return that string, otherwise return the other.

Your Answer

Super Speedy Plugins