Set-ShopifyProductImage

EulandaXtools — Funktionsreferenz

Set-ShopifyProductImage

ÜBERSICHT

Lädt ein Bild zu einem Shopify-Produkt hoch.

SYNTAX

Set-ShopifyProductImage [-Shop] <string> [-Token] <string> [-ApiVersion] <string> [-ProductId]
    <long> [-ImagePath] <string> [[-Position] <int>] [[-AltText] <string>] [[-MaxRetries] <int>]
    [[-TimeoutSec] <int>] [<CommonParameters>]

BESCHREIBUNG

Führt einen dreistufigen Upload-Prozess per GraphQL durch:

1. stagedUploadsCreate -- Upload-URL und Parameter anfordern

2. HTTP POST Multipart -- Bild an die staged URL hochladen

3. productCreateMedia -- Bild am Produkt registrieren

Die Position bestimmt die Reihenfolge in der Galerie.

PARAMETER

-Shop

Type: string

Shopify-Shop-Domain, z.B. 'mein-shop.myshopify.com'.

-Token

Type: string

Admin API Access Token (shpat_...) der Custom App.

-ApiVersion

Type: string

API-Version, z.B. '2025-01'.

-ProductId

Type: long

Shopify-Produkt-ID, zu der das Bild hinzugefügt wird.

-ImagePath

Type: string

Lokaler Pfad zur Bilddatei (JPG, PNG, GIF, WebP).

-Position

Type: int
Default: 1

Position des Bildes in der Galerie (1 = Hauptbild).

-AltText

Type: string

Optionaler Alternativtext für das Bild.

-MaxRetries

Type: int
Default: 3

Maximale Anzahl Wiederholungen bei Rate-Limit.

-TimeoutSec

Type: int
Default: 60

HTTP Timeout in Sekunden.

AUSGABEN

pscustomobject

BEISPIELE

# Hauptbild hochladen
Set-ShopifyProductImage -Shop 'mein-shop.myshopify.com' `
  -Token 'shpat_abc123' -ApiVersion '2025-01' `
  -ProductId 123456789 -ImagePath 'C:\DMS\1100-1.jpg' -Position 1
# Zweites Bild mit Alt-Text
Set-ShopifyProductImage -Shop $shop -Token $token -ApiVersion '2025-01' `
  -ProductId $id -ImagePath 'C:\DMS\1100-2.jpg' -Position 2 -AltText 'Seitenansicht'