PHPackages                             seydoggy/placeholder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. seydoggy/placeholder

ActiveLibrary[Image &amp; Media](/categories/media)

seydoggy/placeholder
====================

A SimpleImage class extension for random placeholder image retrieval.

v1.0.5(9y ago)696512MITPHP

Since Mar 26Pushed 8y ago7 watchersCompare

[ Source](https://github.com/seyDoggy/placeholder)[ Packagist](https://packagist.org/packages/seydoggy/placeholder)[ RSS](/packages/seydoggy-placeholder/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (1)Versions (6)Used By (0)

The Random Image PlaceHolder
============================

[](#the-random-image-placeholder)

**AUTHOR: [Adam Merrifield](https://adam.merrifield.ca)**

Overview
--------

[](#overview)

The SimpleImage PlaceHolder class allows you to self host a random image placeholder engine to fill your in-development sites and mockups with real, random images instead of boring gray boxes. This class extends [SimpleImage](https://github.com/claviska/SimpleImage) by Cory LaViska and is intended as an aid for web developers generate temporary, random placeholder images.

You can use your own images or any freely available creative commons images. Use as many as you like — obviously the more you use, the more random and varied the engine will be. It doesn't matter what size, aspect ratio or orientation you use, PlaceHolder will work out the best fit when generating the placeholder image.

---

Requirements
------------

[](#requirements)

- PHP 5.6+
- [SimpleImage](https://github.com/claviska/SimpleImage) (composer should take care of that)

---

Installation
------------

[](#installation)

Install with Composer:

```
composer require seydoggy/placeholder
```

---

Getting Started
---------------

[](#getting-started)

1. The example folder contains a `.htaccess` file, and images folder and an `index.php` file.
2. Copy these files to the public location of your domain/sub-domain.
3. Use composer to install PlaceHolder:

    ```
    composer require seydoggy/placeholder
    ```

NOTE: the .htaccess and index.php contain just enough to get you going and the folder names, paths and namespaces are arbitrary. Consider them examples of what you need at a minimum but are by no means set in stone. Change the paths and namespaces to suit your current setup. If you are pretty new at all this, consider getting PlaceHolder running all on its own in a dedicated sub-domain before trying to run it in a folder on your main domain.

---

Usage
-----

[](#usage)

### Basics

[](#basics)

Make a request of your new PlaceHolder engine with a minimum of 2 parameters — width then height — separated by a dash. Like this, `http://image.domain.url/600-400`.

In an HTML img tag it'd look like this:

```

```

Or a CSS background would look like this:

```
.header {
    background: #000 url(http://image.domain.url/960-200) center center no-repeat;
}
```

### Fun Tricks

[](#fun-tricks)

There is also an optional third parameter which will perform a few modifications to the generated image.

- Introducing square image handling, example:

    ```

    ```
- `bw` will render the random image in black and white:

    ```

    ```
- `sepia` will render the random image in sepia tones:

    ```

    ```
- `sketch` will render the random image in with sharpness turned up to give a sketched effect (meh):

    ```

    ```
- `pixelate` will render the random image pixelated beyond recognition (pretty cool):

    ```
