Overview

Classes

  • Meme_generator
  • Overview
  • Class
  • Tree

Class Meme_generator

Meme generator class:

  • Generates image file with two lines of text - top & bottom
  • Is very customizable
  • Works well with different frameworks (tested on CodeIgniter)
  • Supports watermarking
Copyright: Copyright © 2013 Neart Interactive Agency, Libera Solutions Ltd.
Author: http://neart.eu/
Version: 1.0
Example: ./example.php Class usage examples
Located at Meme_generator.php
Methods summary
public
# __construct( )
public
# load_config( Array $config )

Bulk config load - instead of setters

Bulk config load - instead of setters

Parameters

$config
Array
class configuration array, possible keys: meme_font / meme_output_dir / meme_font_to_image_ratio / meme_margins_to_image_ratio / meme_image_path / meme_top_text / meme_bottom_text / meme_font meme_watermark_file / meme_watermark_margins / meme_watermark_opacity
public
# set_image( String $image_path )

Sets image file path

Sets image file path

Parameters

$image_path
String
image file path
public
# set_top_text( String $txt )

Sets TOP text on image

Sets TOP text on image

Parameters

$txt
String
public
# set_bottom_text( String $txt )

Sets BOTTOM text on image

Sets BOTTOM text on image

Parameters

$txt
String
public
# set_font( String $file )

Sets font for texts (TTF)

Sets font for texts (TTF)

Parameters

$file
String
font file path
public
# set_output_dir( String $path )

Sets output path for generated image (default to ./)

Sets output path for generated image (default to ./)

Parameters

$path
String
path
public
# set_font_ratio( float $ratio )

If You know what You're doing - You can change font size to image ratio (default to 0.04) Recommended values: 0.01 - 0.05

If You know what You're doing - You can change font size to image ratio (default to 0.04) Recommended values: 0.01 - 0.05

Parameters

$ratio
float
public
# set_quality( mixed $q )

Sets output image quality - default to 90

Sets output image quality - default to 90

public
# set_margins_ratio( float $ratio )

If You know what You're doing - You can change margins to image ratio (default to 0.02) Recommended values: 0.01 - 0.05

If You know what You're doing - You can change margins to image ratio (default to 0.02) Recommended values: 0.01 - 0.05

Parameters

$ratio
float
public
# set_watermark( String $path )

Set watermark PNG image file path

Set watermark PNG image file path

Parameters

$path
String
PNG file path
public
# set_watermark_margins( integer $margins = 10 )

Sets watermark margins - right & bottom, defaults to 10 px

Sets watermark margins - right & bottom, defaults to 10 px

Parameters

$margins
integer
margins in pixels
public
# set_watemark_opacity( integer $opacity = 50 )

Sets watermark opacity - default to 50

Sets watermark opacity - default to 50

Parameters

$opacity
integer
opacity 0 - 100
public
# clear( )

Resets all of the values used when processing an image. You will want to call this if you are processing images in a loop.

Resets all of the values used when processing an image. You will want to call this if you are processing images in a loop.

public
# debug( )
public String
# generate( )

Generate meme on image file

Generate meme on image file

Returns

String
newly created image file name (stored in $this->config['meme_output_dir'] )
Properties summary
public mixed $config
#
Meme Generator PHP Class API documentation generated by ApiGen 2.8.0