Skip to main content

I have a Zap set up that triggers the OpenAI API to generate images, but the problem is that the response only comes back as a base64-encoded string.

I’ve been able to work around this by running the base64 through a Google Apps Script that uploads the image to Google Drive, but it’s not very efficient.

The main issue is that the base64 string is just too large to handle inside a Zapier code step or embedding it dreictly causes timeouts or errors.

I’m wondering if there’s a better way to decode or host the image. If anyone’s run into this before or has suggestions on a cleaner way to handle the image output, I’d really appreciate the help.

Thanks in advance!

Hi ​@Ethan Proenca,

 

Welcome to the Community.

Handling large base64-encoded strings in Zapier can be tricky due to size limits, but there are a few effective workarounds. You can use Zapier's File Utilities to convert the string to a file, host the image on an external service and use the URL, or upload it directly to cloud storage like AWS S3 or Google Cloud. Be mindful of performance, as large files can slow down your Zap.

If you continue to experience issues or need further assistance, please don't hesitate to let us know. We're here to help.


Any idea how to upload the b64 encoded images to Google Drive without needing an App Script?. Every attempt I’ve done has uploaded either a txt file or a non supported image.


Hi ​@Ethan Proenca,

 

Uploading base64-encoded images to Google Drive via Zapier can be challenging without using Google Apps Script, but it is possible with a few creative steps. Since Zapier's Formatter doesn't support base64 decoding, one approach is to use a third-party service like CloudConvert to convert the base64 string into a usable image format or URL. Once you have a valid image file or a publicly accessible direct URL, you can use Zapier's "Upload File" action in the Google Drive integration to store the image. Alternatively, if you're comfortable with coding, you can use a custom webhook to pass the decoded image from a lightweight server or automation tool back into Zapier for upload.

 

Feel free to reach out if you have any questions or need further assistance. We're here to help.