Image aspect ratio error when posting to Instagram from WordPress.
Hi,
In the attached issue you can see that I am receiving an image aspect ration error when posting to Instagram for Business. My flow is creating a post in instagram when a new post is published in Wordpress.
I need Zapier to change the image aspect ratio as part of the flow. It is not manageable for me to make changes manually each time this happens.
Is this possible in Zapier? It would need to check the aspect ratio each time and change if required.
Page 1 / 1
Hi @steve_AWN
Good question.
We would need to see detailed screenshots with how your Zap steps are configured to have enough context.
Hi @Troy Tessalone
Thank you - here are some screen prints of the steps:
I also notice that the link posted to instagram is not clickable, so I will look at that as a separate issue.
Many Thanks,
Steve
Run ID 01078803-f4c4-a2d4-bef0-c1b46eb94dd1
is one of the few that failed this morning with this error.
@steve_AWN
We would need to see screenshots of the DATA IN/OUT for each step in the example Zap Run.
HI - see attached. Let me know if there is more information required. Thank you!
While Zapier lacks native image editing capabilities, achieving your desired workflow is possible through alternative steps. Consider exploring dedicated image manipulation tools available within Zapier's ecosystem, like Image Optimizer or ImageResize.io.
These tools can be integrated into your Zap to automatically analyze image aspect ratios on every WordPress post publication. If the ratio doesn't match Instagram's requirements, these tools can resize the image accordingly before it reaches your Instagram Business account, streamlining your automation and eliminating manual intervention.
Hi there @steve_AWN,
I did some digging into this, and it seems like Instagram is only able to accept images that already fit between the aspect ratio ranges of 4:5 and 1.91:1.
That said, you might need to add an another app to resize the image before sending to Instagram.
Thank you - I am unable to get involved in further applications which will ultimately require more subscription payments. I’d prefer to run some code to check if the size is greater than 1500 x 1500 (according to instagram image post size). Can this be done and if so what is the code required?
@steve_AWN I had a similar issue, I was able to solve this using the code by Zappier block.
First, the issue is that Instagram expects an image with an aspect ratio between 4:5 and 1.91:1.
So basically you need to look through all the images attached to the particular WordPress post and choose the best one that falls between this ratio.
You can combine the info from Instagram and WordPress API to write a JavaScript code that solves the issue
Thank you, @redehubng - this is really interesting and useful. However in my scenario, there is only one image, the featured image. Hopefully there is some code that will resize it!
Interestingly you use wp links featured media href as your reference item in the input. I tried that and it failed to find the image, so I merged to generate some code in an additional zapier step which gets the actual URL then I pass that into Instagram (see below). I’ve seen loads of posts using that input reference but I couldn’t seem to get it to work, hence this additional code. The input is a bit of wordpress post that contains the url (maybe I could have just referenced that item instead of adding code, something I will investigate).
# Define a function to extract the first image URL from a string def extract_image_url(image_urls): # Split the string into a list of URLs urls = image_urls.split(",") # Return the first URL in the list return urls 0]
# Get the image URL from the input data image_urls = input_data="image_url"] # Call the function to extract the first image URL url = extract_image_url(image_urls)
# Print the URL print(url)
# Create a dictionary with the URL as the output output = {"url": url}
@steve_AWN
The way WordPress media works is that for every featured image ( or any other image) there are always multiple versions generated for you by WordPress and your theme can add extras too.