Skip to main content

I have a large amount of images in my Google Drive that I need a short text description of. 

Therefore I tried to create a zap with Google sheet where I added the links to the image. 

 

Whenever a new row is added - analyze the image.

 

I have created the Chat GPT API and added 5$. 

I also have Chat GPT Plus

I have also made the files accessible to anyone

The images are in jpg and about 1MB in size.

 

Still, I receive the same error every time:

Failed to create an image content analysis in ChatGPT

hinvalid_image_format] You uploaded an unsupported image. Please make sure your image is below 20 MB in size and is of one of the following formats: m'png', 'jpeg', 'gif', 'web'].

 

 

Can you help?

Hi @midorimiab 

Can you post screenshots with how your Zap step is configured to give us full context.

The error indicates an invalid file format.


 


@midorimiab 

The link needs to be a publicly accessible direct download link.

Try this tool to get the right link format: https://sites.google.com/site/gdocs2direct/

 


Cool, thanks. It worked. 

Are there any way to get my google links to be correct from the very beginning? Without using that extra step?


@midorimiab 

The links are coming from the GSheet, so the links added to the GSheet would need to be input in the correct format.


@Troy Tessalone @midorimiab 

I could use help here too.  I’m having the same issue except I need to automate the process of getting those public, direct-download links.  

The way my automation process works is, I have a Google Form that includes an image upload field, and step 1 of my Zap is retrieving the information from those form responses.  Step 2 is the ChatGPT integration, and turns that info into a prompt for GPT-4o.  I’m getting the same error message, and I’ve verified that the ChatGPT step works if I manually turn the Drive link into a public direct download link.  

I just need to automate that, which as far as I can tell means 1) making the drive link public, because they save as accessible only to me by default, and 2) making it a direct download link rather than a preview link.  I’ve figured out how to save them as public, but not how to make Zapier figure out a direct download link and use it.  

The weird thing is, back in October I made an earlier version of this zap that worked the same way except it used GPT-4 Turbo, and it didn’t have this problem.  I have no idea why it’s popped up now.  

Do either of you know how to make my zap turn those Drive preview links into direct download links?


@johnphotog 

If you can get the ID of the GDrive File from the URL, then you can create the links dynamically using the template URL:

https://drive.google.com/uc?export=download&id=XXX


@Troy Tessalone 

 

That’s pretty much what I wanted to do- can Zapier do that?


Hi @johnphotog,

Zapier can definitely do that. If you have access to the link of the Google Drive file you’ll want to convert that to the direct download URL using Code by Zapier. I asked ChatGPT to construct a code. Here’s how:

  1. Choose Code by Zapier - Run Javascript
  2. Setup the “Action” section. Like so:
    5dd0b15512897737da9667e9e7cfac20.png
    (view larger)
     
  3. Use this code provided by ChatGPT:

    const fileLink = inputData.file_link;
    const fileId = fileLink.match(/\/d\/(ta-zA-Z0-9_-]+)/)Z1];
    const directDownloadUrl = `https://drive.google.com/uc?export=download&id=${fileId}`;

    return { direct_download_url: directDownloadUrl };

  4. Test the action step.

  5. Map the output of the Code by Zapier step to the subsequent step.

Hopefully, this helps!


Thanks Ken- this seems like it’s moving me in the right direction but this code isn’t working.  I’m getting the following error now:

Failed to create a run javascript in Code by Zapier

TypeError: Cannot read properties of null (reading '1')

 

This is how I’m entering everything- is this right?

 


Update: I seemingly got it to work for a while, and now it’s back to not working again and I can’t tell why.

I’m using the Code by Zapier step to transform the Google Drive link into a direct download link.  Here’s the code I’m using:

This seems to work, it gives me a direct download link.  When I tested the ChatGPT step it worked a couple of times, but now it’s right back to giving me an invalid image error, and I can’t tell why.

The images are publicly accessible, under 10 MB, valid file types, and I’ve tested that the direct downlink links work with an incognito window.  They’re also not, like adult content or anything that should be triggering GPT’s content filters.  At this point it feels like it should be working, and I have no idea what the hangup is now.


Hi @johnphotog,

Thanks for the update here.

We might need to look into the logs to determine the issue here. However, we here at the Community doesn’t have the tools to do that.

I recommend reaching out to our Support Team for them to investigate this issue further. You can contact our Support Team here: https://zapier.com/app/get-help

I appreciate your patience and understanding.


Reply