PHP code example of gevorggalstyan / image2html

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

    

gevorggalstyan / image2html example snippets





use \GevorgGalstyan\Image2HTML\Converter;



$image_converter = new Converter('./images/logo.png');
$image_converter->set_width(256);

$table_html = $image_converter->get_as_table();

echo $table_html;



$image_converter = new Converter('./images/logo.png');
$image_converter->set_width(256);

$style_html = $image_converter->get_as_style();

echo '<div style="' . $style_html . '"></div>';


    const HEXA = 0;
    const RGBA = 1;
    const BEST = 2;


public function set_path($path) {...}
public function set_color_type($type) {...}
public function set_width($width) {...}
public function set_pixel_size($size) {...}
public function set_blur($blur) {...}
public function set_true_color($true_color) {...}



$image_converter = new Converter('./images/logo.png', 256);

$table_html = $image_converter->get_as_table();

echo $table_html;


public function __construct($file_name,
                            $width = 100,
                            $color_type = Converter::BEST,
                            $pixel_size = 1,
                            $blur = 0,
                            $true_color = TRUE) 
                            {
                            ...
                            }