PHP code example of runapi-ai / ideogram-v3

1. Go to this page and download the library: Download runapi-ai/ideogram-v3 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

runapi-ai / ideogram-v3 example snippets




unApi\IdeogramV3\IdeogramV3Client;

$client = new IdeogramV3Client(); // reads RUNAPI_API_KEY

$remixImageTask = $client->remixImage->create([
    'model' => 'ideogram-v3-character-remix',
    'aspect_ratio' => '1:1',
    'enable_prompt_expansion' => true,
    'negative_prompt' => 'sample',
    'output_count' => 1,
    'prompt' => 'Make it golden hour',
    'reference_image_urls' => ['https://cdn.runapi.ai/public/samples/image.jpg'],
    'reference_mask_urls' => ['sample'],
    'rendering_speed' => 'turbo',
    'seed' => 1,
    'source_image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
    'strength' => 0.5,
    'style' => 'auto',
    'style_reference_image_urls' => ['https://cdn.runapi.ai/public/samples/image.jpg'],
]);

$task = $client->textToImage->create([
    'model' => 'ideogram-v3-character',
    'aspect_ratio' => '1:1',
    'enable_prompt_expansion' => true,
    'negative_prompt' => 'sample',
    'output_count' => 1,
    'prompt' => 'A precise product render on white marble',
    'reference_image_urls' => ['https://cdn.runapi.ai/public/samples/image.jpg'],
    'rendering_speed' => 'turbo',
    'seed' => 1,
    'style' => 'auto',
]);

$status = $client->textToImage->get($task->id);

$result = $client->textToImage->run([
    'model' => 'ideogram-v3-character',
    'aspect_ratio' => '1:1',
    'enable_prompt_expansion' => true,
    'negative_prompt' => 'sample',
    'output_count' => 1,
    'prompt' => 'A serene mountain lake at dawn',
    'reference_image_urls' => ['https://cdn.runapi.ai/public/samples/image.jpg'],
    'rendering_speed' => 'turbo',
    'seed' => 1,
    'style' => 'auto',
]);

echo $result->images[0]->url . PHP_EOL;