๐ฌ Generate AI images with Gemini and upload them to WordPress (sub-workflow)
โก 61 views ยท ๐ฌ Content Creation & Video
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
querystring 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, andaltto 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-Dispositionheader 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
HTTP Request, Execute Workflow Trigger, Google Gemini
๐ฅ Import
Download workflow.json and import into n8n:
Workflow menu โ Import from File