PHP code example of wikigods / image-generator

1. Go to this page and download the library: Download wikigods/image-generator 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/ */

    

wikigods / image-generator example snippets


use WikiGods\ImageGenerator\Facades\ImageGenerator;

$path = ImageGenerator::image(
    dir: storage_path('app/public/images'),
    text: 'Hola Mundo',
    fontPath: resource_path('fonts/Nunito-Regular.ttf'),
    width: 640,
    height: 480,
    fullPath: true,
    format: 'png',
    category: 'product'
);

$path = fake()->image(
    storage_path('app/public/images'),
    300,
    200,
    true,
    'jpg',
    null,
    null,
    null,
    'computer',
    'ram',
    'NovaTech RAM'
);

$ram = fake()->computerImage('ram', $dir); // imagen de RAM sin etiqueta
$computerPart = fake()->computerImage(null, $dir); // variante de computadora aleatoria
$car = fake()->categoryImage('car', $dir, 640, 480, true, 'png', 'sedan', 'Sedán azul');

image(
    $dir = null,
    $width = 640,
    $height = 480,
    $fullPath = true,
    $aImageType = null,
    $thumbsDir = null,
    $text = null,
    $fontPath = null,
    $category = 'random',
    $variant = null,
    $name = null
)