Download the PHP package marccoup/social-image-generator without Composer
On this page you can find all versions of the php package marccoup/social-image-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download marccoup/social-image-generator
More information about marccoup/social-image-generator
Files in marccoup/social-image-generator
Package social-image-generator
Short Description Generate simple images suitable for open graph protocol sharing
License MIT
Homepage https://github.com/marccoup/social-image-generator
Informations about the package social-image-generator
Generate simple social images for the Open Graph protocol
Requirements
- PHP >= 8.1
- Fileinfo Extension
- One of the following image libraries:
- GD Library >= 2.0
- Imagick PHP extension >= 6.5.7
Installation
Usage
Driver configuration
This package depends on intervention/image and requires an instance of their
ImageManager
class to be injected into the SocialImageGenerator
for driver configuration.
Refer to their documentation on driver configuration for more information.
Fonts
The only other thing required for this package to work is any .ttf
font file to be used for the text written to the
generated images.
Building your image
This package provides a fluid API for building an image, with sensible (if boring) defaults.
Once your generator object has been configured how you like, you can generate your image.
The only non-chainable method is the one that should always be the final one in the chain - $generator->generate()
-
which will return an instance of Intervention\Image\Image
for you to save, or otherwise do with as you wish.
Usually using the $generator->generate()
method will be all you need but if you wish to write the sections of the
image in a different order, want multiple lattices, or to do anything else with the image you can interact with it in the
following ways:
Working example
The best example I can give, how I generated the image at the top of this readme. As long as you have the font, this code should generate the exact same image.