romulinux/favicon-generator

为您的网站生成favicon和应用程序图标的图像和html。

1.0.8 2019-02-01 03:49 UTC

This package is auto-updated.

Last update: 2024-09-18 23:59:18 UTC


README

为您的网站生成favicon和应用程序图标的图像和html。

要求

php 7.2 和 php7.2-gd

用法

本地php服务器

php -S localhost:8888 # access this link on your browser

在您的项目中,在composer.json中包含此代码

"minimum-stability": "dev",
"prefer-stable": true,
"require": {
  "romulinux/favicon-generator": ">=1.0.0"
}

在您的php项目中调用

<?php
  use Favicon\FaviconImageGenerator as FaviconImageGenerator;
  use Favicon\FaviconHtmlGenerator as FaviconHtmlGenerator;

  $applicationName = 'Teste';
  $faviconDir = 'assets/icons/';
  $msapplicationTileColor = '#FFF';
  $themeColor = '#FFF';
  $titleBarColor = '#FFF';

  echo '<head>';
    $faviconHtmlGenerator = new FaviconHtmlGenerator($applicationName, $faviconDir, $msapplicationTileColor, $themeColor, $titleBarColor);
    echo $faviconHtmlGenerator->generate();
  echo '</head>';
?>

要生成目录'assets/icons'中的favicon和应用程序图像,请编写以下代码

<?php
  $faviconImageGenerator = new FaviconImageGenerator($faviconDir, 'assets/img/favicon.png', 'assets/img/favicon.png');
  $faviconImageGenerator->generate();
?>
This code will generate the images using the 'assets/img/favicon.png' image and put the output in dir 'assets/icons/'