PHP code example of ankitpokhrel / alt

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

    

ankitpokhrel / alt example snippets


$alt = new \Alt\Alt('/path/to/image.ext');

echo $alt->alt(); // Image may contain: 6 person, cup, laptop

$alt->setImage('/path/to/image.ext')->alt(); // Image may contain: car, motorcycle

$alt->setThreshold(25);

$alt->setPrefix('Image has: ');

$alt->setImage('/path/to/image.ext')->alt(); // Image may contain: 5 person, dog, cup

// Adding dog as countable
$alt->setCountable(['person', 'dog'])->alt(); // Image may contain: 5 person, 2 dog, cup

$alt->setDefaultText('Some scenery.');