定制 drago-ex/gravatar 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

drago-ex/gravatar

最新稳定版本:v1.0.6

Composer 安装命令:

composer require drago-ex/gravatar

包简介

Simple and customizable Gravatar integration for PHP applications, allowing easy Gravatar image generation based on user email with options for size, default image, and rating.

README 文档

README

Simple and customizable Gravatar integration for PHP applications.

License: MIT PHP version Tests Coding Style

Requirements

  • PHP >= 8.3
  • Nette Framework
  • Composer

Installation

composer require drago-ex/gravatar

Extension Registration

After installation, register the extension in your Nette configuration (neon file):

extensions:
	gravatar: Drago\Gravatar\DI\GravatarExtension

Optional configuration

gravatar:
	size: 80
	defaultImage: "mm"
	rating: "g"

You can adjust the size, defaultImage, and rating parameters based on your needs.

Examples

Once the extension is registered, you can use the Gravatar functionality in your presenters and templates.

Overview

Drago Gravatar is a simple, customizable solution for integrating Gravatar images into your PHP application. With this package, you can easily generate and display Gravatar images based on user email addresses, allowing you to customize their size, default image, and rating.

Features

  • Generate Gravatar images based on user email.
  • Customizable image size (from 1 to 2048 pixels).
  • Choose a default image if the user has no Gravatar.
  • Set image rating (g, pg, r, x).
  • Easy integration into your Nette-based application.

Using Gravatar in Presenters

Add the GravatarAdapter trait to your presenter:

use Drago\Gravatar\GravatarAdapter;

protected function beforeRender(): void
{
	parent::beforeRender();
	$gravatar = $this->gravatar;
	$gravatar->setEmail('someone@somewhere.com');

	$this->template->gravatar = $this->gravatar->getGravatar();
}

In Template

In your Latte template, simply output the Gravatar image by using the URL provided by the presenter:

<img src="{$gravatar}" alt="">

Customizing Gravatar

You can customize the Gravatar by changing the size, defaultImage, and rating parameters in the configuration:

size: The size of the Gravatar image in pixels (1 to 2048). Default is 80. defaultImage: The default image used when the user doesn't have a Gravatar (e.g., mm, identicon, monsterid, wavatar, etc.). Default is mm. rating: The rating of the Gravatar image (g, pg, r, x). Default is g.

统计信息

  • 总下载量: 198
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-05-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固