2017 © Pedro Peláez
 

library placeholder

Laravel Package for using a placeholder image service to add images to your application.

image

rufhausen/placeholder

Laravel Package for using a placeholder image service to add images to your application.

  • Friday, December 23, 2016
  • by rufhausen
  • Repository
  • 1 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Placeholder

Laravel 5.3 Package for using a placeholder image service to add images to your application., (*1)

Services supported

Currently supports unsplash.it and placeimg.com., (*2)

Getting Started

Currently, the package consists of two facades: Placeholder and Placeimage. Placeholder is strictly for outputing placeholder image tags, while Placeimage will attempt to use an existing image public path, but revert to a placeholder image if the images does not exist., (*3)

Code Examples

Using the Placeholder tag

//Usage:

\Placeholder::make($width, $height = null, $tagAttributes = null, $imageOptions = null);

//Basic Example:

\Placeholder::make(200);
//outputs: <img src="https://unsplash.it/200/200?random"> using unsplash.it

//Full Example:

\Placeholder::make(200, 200, ['class' => 'img-responsive', 'id' => 'placeholder'], ['color' => 'grayscale']);
//outputs:
<img src="https://unsplash.it/g/200/200?random" class="img-responsive" id="placeholder"> using unsplash.it

Using the Placeimage tag

//Create an image tag that will revert to placeholder if the image does not exist:

//Usage:

\Placeimage::make($imagePath, $width, $height = null, $tagAttributes = null, $imageOptions = null);

//Basic Example:

\Placeimage::make('/img/test.jpg', 200);
//outputs: <img src="/img/test.jpg"> using unsplash.it
\Placeimage::make('/img/foo.jpg', 200, null, ['width' => '200', 'class' => 'img-responsive'], ['color' => 'grayscale']); //image does not exist

//outputs: <img src="https://unsplash.it/g/200/200?random" width="200" class="img-responsive"> using unsplash.it

Installation

Add the package to composer.json, (*4)

php composer.phar require intervention/image

Add the package provider to providers array in config/app.php:, (*5)

Rufhausen\Placeholder\PlaceholderServiceProvider::class,

Add the facades to the facades array in config/app.php:, (*6)

'Placeholder'  => Rufhausen\Placeholder\Placeholder::class,
'Placeimage'   => Rufhausen\Placeholder\PlaceImage::class,

Publish the config:, (*7)

php artisan vendor:publish --provider="Rufhausen\Placeholder\PlaceholderServiceProvider"

License

Placeholder is licensed under the MIT License., (*8)

Copyright 2016 Gary Taylor, (*9)

The Versions

23/12 2016

dev-master

9999999-dev

Laravel Package for using a placeholder image service to add images to your application.

  Sources   Download

MIT

The Requires

  • php >=5.6.4

 

by Gary Taylor

laravel images placeholder