marbie77/emailcountdown

Email Countdown class to generate GIF

2.1.0 2021-10-23 19:58 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:53:19 UTC


README

Just some simple PHP classes to generate a countdown (60 seconds GIF animation) to be used as fake counter in an email

The image itself works with Outlook, but it shows only the first frame of the GIF animation.

Installation

Use Composer to install it

composer require marbie77/emailcountdown

Usage

Create the class, use the options and output the GIF.

$emailCountdown = (new EmailCountdown\CircleCountdown())->setDestinationTime(! empty($_GET['dest_time']) ? $_GET['dest_time'] : null)
    ->setTextColor(! empty($_GET['text_color']) ? $_GET['text_color'] : null)
    ->setBackgroundColor(! empty($_GET['background_color']) ? $_GET['background_color'] : null);

// content type gif
header('Content-Type: image/gif');
// no caching of gif, so it gets reloaded every time
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
echo $emailCountdown->getGIFAnimation();

Examples

To check the examples, first install dependencies with composer install

Then navigate to example.php or example_wallpoet.php

Changelog

2.1.0

  • adding PR for setting max frames from simoheinonen

2.0.1

  • adding new function to customize shown text and position
  • adding font Wallpoet-Regular to show additional example (example_wallpoet.php)

2.0.0

  • added PHPDocs and new coding standards i.e.
    • removed all underscores from properties and methods
    • using camelCase now
  • includes PR from @igumenov - thank you!

1.0.0

  • Initial version