n8n auto-hébergé | automatisation sécurisée et évolutive
100 formations en marketing digital et Intelligence Artificielle
Atlas Cloud | Full-Modal AI Platform - One API for All Modalities

const item = items[0];
if (
!item.binary ||
!item.binary.image1 ||
!item.binary.image2 ||
!item.binary.image3
) {
throw new Error('Missing binary images (expected image1, image2, image3)');
}
return [
{
json: { imageNumber: 1 },
binary: { image: item.binary.image1 }
},
{
json: { imageNumber: 2 },
binary: { image: item.binary.Image2 }
},
{
json: { imageNumber: 3 },
binary: { image: item.binary.Image3 }
}
];
function extractOpenAIText(it) {
// Après Merge by position, OpenAI est sous la clé "0"
const openai = it.json?.["0"];
if (openai?.content && Array.isArray(openai.content)) {
const t = openai.content.map(x => x?.text).filter(Boolean).join("\\n");
if (t) return t;
}
// fallback
if (typeof openai?.text === "string" && openai.text.trim()) {
return openai.text.trim();
}
return null;
}
function extractDriveUrl(it) {
return it.json?.webContentLink || it.json?.webViewLink || null;
}
function formatTmpfilesPublicUrl(it) {
const raw = it.json?.data?.url;
if (!raw) return null;
return raw.replace(
/^http:\\/\\/tmpfiles\\.org\\/(\\d+)\\/(.*)$/i,
"<https://tmpfiles.org/dl/$1/$2>"
);
}
const rows = items.map((it, idx) => ({
n: idx + 1,
desc: extractOpenAIText(it) || "No description",
url: extractDriveUrl(it) || "No link",
url_public: formatTmpfilesPublicUrl(it) || "No link",
}));
return [{
json: {
image1Description: rows[0]?.desc || "No description",
image2Description: rows[1]?.desc || "No description",
image3Description: rows[2]?.desc || "No description",
// URLs Drive
image1Url: rows[0]?.url || "No link",
image2Url: rows[1]?.url || "No link",
image3Url: rows[2]?.url || "No link",
imageUrls: rows.map(r => r.url).filter(u => u && u !== "No link"),
// URLs publiques formatées (tmpfiles → /dl/)
image1Url_public: rows[0]?.url_public || "No link",
image2Url_public: rows[1]?.url_public || "No link",
image3Url_public: rows[2]?.url_public || "No link",
imageUrls_public: rows
.map(r => r.url_public)
.filter(u => u && u !== "No link"),
allDescriptions: rows.map(r => `Image ${r.n}: ${r.desc}`).join("\\n\\n"),
}
}];
Prompt (User Message) :
Your task is to create an image prompt following the system guidelines.
Ensure that the reference image is represented as **accurately as possible**, including all text elements.
Use the following inputs:
- **IMAGES’s description:**
{{ $json.allDescriptions }}
System Message :
You output a prompt that is a variation of the prompt below. Follow this prompt exactly but just change:
-the hand positioning based on what makes sense for the product
-how the product is worn and where it is placed
everything else stays the same
***
Show a high fashion studio photoshoot image of this reference character as a photorealistic model wearing the featured apparel and product, captured as a full body shot. The model looks slightly past the camera with a bored expression and raised eyebrows. One hand is lifted, with two fingers interacting with or touching the featured product in a natural, stylish way.
The setting is a clean studio environment with a solid color background that matches the primary color of the character. The featured product is intentionally prominent.
The image is shot from a low angle, looking up at the subject to emphasize presence and dominance.
The photo is captured on Fuji Velvia film using a 55mm prime lens with hard flash lighting. Light is concentrated on the subject and softly fades toward the edges of the frame. The image is intentionally overexposed, with visible film grain and heavy oversaturation. Skin appears shiny, almost oily, and the featured product shows harsh white reflections that highlight its surface and form.
Method POST
<https://tmpfiles.org/api/v1/upload>
Body Content Type
Form-Data
Parameter Type
n8n binary file
Name : file
Input Data Field Name : data