PlaceholderGen Documentation

Generate beautiful AI images for your website with simple HTML attributes.

Getting Started

Add PlaceholderGen to your website with a simple script tag

To start using PlaceholderGen, include the following script in the head section of your HTML:

Include this script in your HTML head section

<script>
  (function(p,g,e,n){
      p.PlaceholderGenConfig = { authKey: "_YOUR_AUTH_KEY_" };
      s = g.createElement(e);
      s.src = n;
      s.async = true;
      g.head.appendChild(s);
  })(window, document, 'script', 'https://cdn.placeholdergen.com/pgen.js');
</script>

Replace _YOUR_AUTH_KEY_ with your actual authentication token from the dashboard.

Token Types

Understanding the different types of authentication tokens

The development token offers full read and write access to our API. It doesn't check the domain where it's used, making it ideal for local development and testing.

Image Caching

Optimize performance by controlling how image URLs are cached

By default, PlaceholderGen caches image URLs to improve performance and reduce unnecessary server requests. This means that once an image URL has been fetched for a specific prompt, it will be reused from the cache when the page is refreshed.

Disabling Cache

In some scenarios, you may want to disable caching - especially when generating new variations of images and wanting to see immediate changes. To disable caching, set the cacheEnabled property to false in the configuration:

Script with caching disabled

<script>
  (function(p,g,e,n){
      p.PlaceholderGenConfig = { 
        authKey: "_YOUR_AUTH_KEY_",
        cacheEnabled: false 
      };
      s = g.createElement(e);
      s.src = n;
      s.async = true;
      g.head.appendChild(s);
  })(window, document, 'script', 'https://cdn.placeholdergen.com/pgen.js');
</script>

HTML Attributes

Customize your image generation with these simple HTML attributes

pgen-prompt

Required

The text description of the image you want to generate. Be as descriptive as possible for best results. Must be at least 20 characters long.

pgen-model

Optional
Default: stable-diffusion

The AI model to use for image generation. Currently supports 'stable-diffusion' and 'dall-e'. More AI models will be added based on user demand.

pgen-ratio

Optional
Default: square

The aspect ratio of the generated image. Options are 'square', 'landscape', or 'portrait'.

pgen-size

Optional

Custom image dimensions in the format 'widthxheight' (e.g., '300x500'). This feature is only available for users with an active subscription.

Coins

Understanding how the coin system works for subscriptions and purchases

Coins are the currency used to generate images on PlaceholderGen. There are two types of coins: subscription coins and purchased coins, each with different expiration rules.

Subscription Coins

Subscription coins are included with your subscription plan and are renewed at the beginning of each billing cycle. Any unused subscription coins do not roll over to the next billing cycle.

Purchased Coins

Purchased coins are additional coins you buy separately from your subscription. These coins expire 3 months from the date of purchase.

You can view your current coin balance and expiration dates in your account dashboard.

Usage Examples

See how to implement PlaceholderGen in your HTML

HTML Implementation Examples

<!-- Basic image with prompt -->
<img pgen-prompt="A beautiful mountain landscape at sunset" />

<!-- Image with specified model -->
<img pgen-prompt="An astronaut riding a horse on Mars" pgen-model="dall-e" />

<!-- Image with aspect ratio -->
<img pgen-prompt="A futuristic cityscape" pgen-ratio="landscape" />

<!-- Image with custom size (for subscribers) -->
<img pgen-prompt="A vintage car on a coastal road" pgen-size="800x600" />

<!-- Combined attributes -->
<img 
  pgen-prompt="A cyberpunk street scene with neon lights" 
  pgen-model="stable-diffusion"
  pgen-ratio="portrait"
  pgen-size="600x900" 
/>

Visual Examples

Example: A beautiful mountain landscape at sunset

stable-diffusion
square

Your generated image would appear here.
The attributes specified will determine how it's created.

HTML code:

<img pgen-prompt="A beautiful mountain landscape at sunset" />

Example: An astronaut riding a horse on Mars

dall-e
square

Your generated image would appear here.
The attributes specified will determine how it's created.

HTML code:

<img pgen-prompt="An astronaut riding a horse on Mars" pgen-model="dall-e" />

Example: A futuristic cityscape

stable-diffusion
landscape

Your generated image would appear here.
The attributes specified will determine how it's created.

HTML code:

<img pgen-prompt="A futuristic cityscape" pgen-ratio="landscape" />

Example: A vintage car on a coastal road

stable-diffusion
square
800x600

Your generated image would appear here.
The attributes specified will determine how it's created.

HTML code:

<img pgen-prompt="A vintage car on a coastal road" pgen-size="800x600" />