2017 © Pedro Peláez
 

library meme-puush

Generate a meme to a local file, echo to the screen, or upload to puu.sh using their API

image

fraserreed/meme-puush

Generate a meme to a local file, echo to the screen, or upload to puu.sh using their API

  • Friday, April 25, 2014
  • by fraserreed
  • Repository
  • 1 Watchers
  • 0 Stars
  • 52 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

meme-puush

Build Status Coverage Status, (*1)

Meme generator using Imagick. Either output local file path, to screen or upload to Puu.sh using the Puu.sh API. Puu.sh API key required (http://puu.sh), (*2)

Installation

Install this package in your application using composer., (*3)

In the require section, add the following dependency:, (*4)

"fraserreed/meme-puush": "~1.0"

Usage

First initialize the image object with an accessible URL to the image:, (*5)

use MemePuush\Image;

$image = new Image( $img );

If the image path doesn't exist, an exception will be thrown when trying to output the meme image., (*6)

Next set the output format. The options are available in class constants of the Image class: Image::PUUSH (will upload the result using the Puu.sh api key), Image::FILE (will store the result locally and provide the output filename) and Image::SCREEN (will output the result to the browser)., (*7)

$image->setOutputFormat( Image::PUUSH, '<puu.sh_api_key>' );

The puu.sh api key is not required if storing the result locally or outputting to the screen., (*8)

$image->setOutputFormat( Image::FILE );

Set the caption string, for the top caption or the bottom caption (or both):, (*9)

$image->setTopCaption( "top caption text" );
$image->setBottomCaption( "bottom caption text" );

Finally output the result. What you do with the response is dependent on the format of the output:, (*10)

$outputContent = $image->output();

switch( $output )
{
      case 'screen':
            header( 'Content-type: image/jpg' );
            echo file_get_contents( $outputContent );
            break;

      case 'file':
            echo $outputContent;
            break;

      case 'puush':
            echo json_encode( array( 'url' => $outputContent ) );
            break;
}

Example

A (really ugly) example UI for creating memes using the three available methods can be seen in public/index.php, (*11)

The Versions

25/04 2014

dev-master

9999999-dev

Generate a meme to a local file, echo to the screen, or upload to puu.sh using their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fraser Reed

meme puush puu.sh

25/04 2014

v1.0.2

1.0.2.0

Generate a meme to a local file, echo to the screen, or upload to puu.sh using their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fraser Reed

meme puush puu.sh

07/04 2014

v1.0.1

1.0.1.0

Generate a meme to a local file, echo to the screen, or upload to puu.sh using their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fraser Reed

meme puush puu.sh

07/04 2014

v1.0.0

1.0.0.0

Generate a meme to a local file, echo to the screen, or upload to puu.sh using their API

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fraser Reed

meme puush puu.sh