Generate AI images with Gemini and upload them to WordPress (sub-workflow)

Go to Workflow
0 views
Built by AI Solutions AI Solutions
Created on June 11, 2026

Description

🖼️ Generate AI Image with Gemini and Upload to WordPress
Sub-workflow — Called by a parent workflow to generate a photorealistic AI image from a text prompt and upload it directly to the WordPress Media Library.

How it works
Receives a query string field via the Execute Workflow Trigger (passthrough mode).
Sends the query to Google Gemini to generate a professional, photorealistic image.
Uploads the resulting binary image to your WordPress Media Library via the WP REST API.
Returns url, media_id, and alt to the calling parent workflow.

Setup
Connect your Google Gemini (PaLM) API credential to the Gemini — Generate Image node.
Connect your WordPress API credential to the WP — Upload Image to Media Library node.
Update the WordPress URL in that node to point to your site: https://your-site.com/wp-json/wp/v2/media.
Call this workflow from a parent workflow, passing a JSON field named query.

Customization
Change the Gemini model in Gemini — Generate Image to adjust image quality or style.
Edit the prompt prefix in the same node to change the default photorealistic tone.
The filename in the Content-Disposition header uses a timestamp — adjust as needed.

⚠️ Community Node Notice: This workflow uses @n8n/n8n-nodes-langchain.googleGemini, a LangChain community node. It requires a self-hosted n8n instance with the LangChain add-on installed.

Nodes Used (2)

Google Gemini
@n8n/n8n-nodes-langchain.googleGemini
HTTP Request
n8n-nodes-base.httpRequest